Ask Your Question

What is 0-based cluster index

asked 2015-03-29 09:25:23 -0500

Abu Gaseem gravatar image

opencv c++ provide the kmean interface :

double kmeans(InputArray data, int K, InputOutputArray bestLabels, TermCriteria criteria, int attempts, int flags, OutputArray centers=noArray() ) I've read the description in the documentaion page kmean interface

I wonder what is the bestLabels argument ,aslo i don't get the following paragraph:

The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, \texttt{labels}_i contains a 0-based cluster index for the sample stored in the i^{th} row of the samples matrix. after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, you can use only the core of the function, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the ( flags = KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering. what they mean by 0-based cluster index?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-29 09:59:24 -0500

Guanta gravatar image

bestLabels gives the label for each data-point where the label refers to a possible cluster-index which were produced, e.g. you cluster your data with K=100, so you have cluster-labels 0-99, now each data vector gets one of these labels, i.e. you will get an output matrix w. 100 rows and 1 column.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-03-29 09:25:23 -0500

Seen: 151 times

Last updated: Mar 29 '15