# k-means clustering

Hi,everyone

How can I use AFNI to do the K-means clustering? Because I want to identify different connectivity patterns.

There is a program called 3dkmeans that may meet your needs.

Hi everyone,

I was wondering what the function 3dkmeans does whit the option -g 0 ?
It seems that it still create clusters, but I don’t understand how (which algorithm is used)?

Thank you in advance for any help!
Carole.

Hello again,

Sorry I have some other questions about this function. As it is mention at the beginning of the help-page program, it seems that the algorithm used are based on the ‘Michiel Jan Laurens de Hoon C Clustering Library’.

1/ In this library, the pearson correlation scores are computed like this:
r =1/n * sum[ ( (xi−mean(x)) / sd(x) ) * ( (yi−mean(y)) / sd(y) ) ]
why not 1/(n-1) instead of 1/n ?

2/ does the ‘uncentered’ version corresponded to the Uncentered correlation (cosine of the angle) described by the ‘Michiel Jan Laurens de Hoon C Clustering Library’?

3/ in the -g 2 option, what do you mean by Weighted_Pearson_Correlation ?

4/ Finally, the help-page mentioned that the -g 7 option is the default when there is only one value per voxel. But could we still use this metric for time-series data (meaning that there is several values per voxel?)

Sorry again for all these questions and thank you for your reply.

Carole

Hi,
This program was written long ago, so I can’t recall everything right now, but as you have found out it is based on Michiel de Hoon’s library, so for details please check clustering documentation (by Michiel de Hoon) that you can find here:

cluster.pdf

2) yes
3) The weight vector contains weights for the elements in the data, by default 1, but it is good to have an option to tweak the data; see documentation page 8
4) yes it can be used with 3d+t data

I have checked cluster.c code and must say, that it is not computed just with 1/n… although it is true they stated in documentation that factor is 1/n.

Hope I cleared some doubts,
Andrej