I have a 1000 by 3 data matrix in which for each person we have 3 scores. I want to cluster those persons into 8 cluster using Agglomerative method. I did the clusetring by:
class=FindClusters[data, 8, DistanceFunction -> ManhattanDistance,
Method -> {"Agglomerate", "Linkage" -> "Complete"}]
I want to find out how and which persons are classified into those 8 clusters.In other words, I want to have a vector of class membership for each person (similar to what we can get using ClusteringComponents[data,8,1]
).
As an example, suppose we have this data set:
data={{3, 2, 4}, {1, 1, 0}, {5, 2, 4}, {2, 3, 2}, {4, 4, 4}, {3, 2, 4}, {3,
2, 3}, {2, 1, 3}}
result of FindClusters
is:
class = FindClusters[data, 3, DistanceFunction -> ManhattanDistance,
Method -> {"Agglomerate", "Linkage" -> "Complete"}]
{{{3, 2, 4}, {2, 3, 2}, {3, 2, 4}, {3, 2, 3}, {2, 1, 3}}, {{1, 1,
0}}, {{5, 2, 4}, {4, 4, 4}}}
through the output it can be seen that persons number 1,4,6,7&8 are classified in first cluster; person number 2 in second cluster and persons number 3&5 are in third cluster. I want to have a vector like:
{1,2,3,1,3,1,1,1}
then I can determine which person is located in which cluster and how many persons are in each cluster.
I decided to use FindClusters
because I didn't get reasonable results from Agglomerate
function for hierarchical clustering. My main aim is doing hierarchical clustering with different linkage functions.
Any help and additional ideas are appreciated.
Amin.
data
, and the results you expect from a proper clustering? $\endgroup$