-2

I'm trying to use vlfeat kmeans algorithm in C++ as I have used it before in matlab. I have two questions.

  1. I can't find a function to return the assignment for each data input. do I have to use the distance function to manually find the assignment?
  2. when I set vl_kmeans_set_verbosity(kmeans, 1); I do not see any verbosity being printed out. how do I get the verbosity to work?
user1871528
  • 1,655
  • 3
  • 27
  • 41

1 Answers1

0

The help page for vl_kmeans clearly states the answer. Use it like this:

[C,A] = vl_kmeans(X, numcenters, 'verbose');

The vector A will have the assigned centers. The help page is here: http://www.vlfeat.org/matlab/vl_kmeans.html

EDIT I got this info from reading the mex file vl_kmeans.c. I don't have the means to try this right now. But let me know if it works.

To quantize:

vl_kmeans_quantize (kmeans, assignments, NULL, data, numData) ;

The verbosity seems to be done the way you do:

  vl_kmeans_set_verbosity (kmeans, 1) ;

But the mex code prints the final stats itself which is not there in the c++ code.

TyanTowers
  • 160
  • 10
  • that's the matlab api, i'm talking about the C api. Given that the matlab api has the assignment and verbosity I was hoping I can do the same in C – user1871528 Sep 23 '16 at 14:38
  • 1
    uh, sorry. I guess I didn't read the question properly. Let me check... – TyanTowers Sep 23 '16 at 15:25