K
- Class label typeV
- Feature vector dimension typepublic class KNNClassifier<K,V> extends java.lang.Object implements Classifier<K,V>
KNNClassifierFactory
class to train and instantiate
a new classifier.
NOTE: partially generified, waiting for final generification of classifiers package.Modifier | Constructor and Description |
---|---|
protected |
KNNClassifier(int k,
boolean weightedVotes,
boolean l2Normalize) |
Modifier and Type | Method and Description |
---|---|
protected void |
addInstances(java.util.Collection<RVFDatum<K,V>> datums) |
K |
classOf(Datum<K,V> example)
NOTE: currently does not support standard Datums, only RVFDatums.
|
java.util.Collection<K> |
labels() |
static void |
main(java.lang.String[] args) |
ClassicCounter<K> |
scoresOf(Datum<K,V> datum)
Given an instance to classify, scores and returns
score by class.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluateAccuracy, evaluatePrecisionAndRecall
protected KNNClassifier(int k, boolean weightedVotes, boolean l2Normalize)
public java.util.Collection<K> labels()
labels
in interface Classifier<K,V>
public K classOf(Datum<K,V> example)
classOf
in interface Classifier<K,V>
public ClassicCounter<K> scoresOf(Datum<K,V> datum)
scoresOf
in interface Classifier<K,V>
public static void main(java.lang.String[] args)