Question

In matlab, I can cluster the data matrix like

[centers, assignments] = vl_kmeans(da, 3);

all the data points in matrix "da" will be divided into 3 clusters.

But, instead of data points, I want to cluster the complete matrices. I have hundreds of matrices of 128*19 and I would like to divide these matrices into five groups.

For example

if there are 11 matrices if 128*19,

After Clustering, I should be able to figure out:

Cluster 1: 1, 7, 11
Cluster 2: 2,4,6,8,10
Cluster 3: 3,5,9

That is center 1 will return the matrices number 1,7,11

How can I achieve this in matlab? Any help/pointer is highly appreciated.

( These 128*19 matrices contains the SIFT descriptors of images, and based on the the classification of these descriptors I would be classifying images)

Thanks.

Was it helpful?

Solution

Simply convert each matrix into a vector of 128*19 length, and concatenate your "matrix vectors" into one huge matrix, which you can cluster as usual.

edit

One important note - kmeans is a clustering not classification algorithm. Kmeans may be used to help classification to reduce the number of descriptors, but not as a classification tool.

edit 2

trivial example:

Having 3 matrices od size 2x2

matrix 1: 
[[1, 2], 
 [2, 3]]

matrix 2: 
[[4, 5], 
 [5, 6]]

matrix 3: 
[[7, 7], 
 [8, 9]]

You can convert them to one big matrix of size 3x4 ( 3x(2*2) )

[ [1,2,2,3],
  [4,5,5,6],
  [7,7,8,9] ]

and use your matlab clustering to cluster it. Each row is one of your original matrices, so you get exactly what you need

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top