k-nearest-neighbour classifier.
If enabled, it stores the votes per class in the 'values' state after
calling predict().
|
|
__init__(self,
k=2,
dfx=squared_euclidean_distance,
voting='weighted',
**kwargs)
Cheap initialization. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getMajorityVote(self,
knn_ids)
Simple voting by choosing the majority of class neighbours. |
source code
|
|
|
|
getWeightedVote(self,
knn_ids)
Vote with classes weighted by the number of samples per class. |
source code
|
|
|
|
|
|
Inherited from base.Classifier:
getSensitivityAnalyzer,
isTrained,
predict,
repredict,
retrain,
summary,
train,
trained
Inherited from misc.state.ClassWithCollections:
__getattribute__,
__new__,
__setattr__,
reset
Inherited from object:
__delattr__,
__format__,
__hash__,
__reduce__,
__reduce_ex__,
__sizeof__,
__subclasshook__
|