scikit-learn-contrib/DESlib

"n_neighbors" is not a multiple of "n_classes" in KNNE

jayahm opened this issue · 2 comments

Hi

I got this warning when using KNNE:

warnings.warn('"n_neighbors" is not a multiple of "n_classes". Got'

            warnings.warn('"n_neighbors" is not a multiple of "n_classes". Got'
                          '{} and {}.One or more classes will have one less'
                          ' instance.'.format(n_neighbors,
                                              self.n_classes_))

I understood that n_neighbors requires a multiply of a number of classes. But, for example, if I set n_neighbors =7 for binary classification of two classes, does it mean the final n_neighbors will be 6?

How about n_neighbors = 11 but with 3 classes? The final n_neighbors is 3 for each class?

@jayahm Hello,

the n_neighbors is still 7, however, the number of neighbors will be 4 belonging to one class and 3 belonging to the other (one class having more neighbors than the other).

I see. Thanks.