Ask Your Question
1

What is 0-based cluster index

asked Mar 29 '15

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?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Mar 29 '15

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.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Mar 29 '15

Seen: 235 times

Last updated: Mar 29 '15