public class KNNClassificationModel extends NNClassificationModel implements Exportable<KNNModelFormat>
distanceMeasure, k, stgy
Constructor and Description |
---|
KNNClassificationModel(Dataset<EmptyContext,LabeledVectorSet<Double,LabeledVector>> dataset)
Builds the model via prepared dataset.
|
Modifier and Type | Method and Description |
---|---|
Double |
apply(Vector v) |
void |
copyStateFrom(KNNClassificationModel mdl)
Copy parameters from other model and save all datasets from it.
|
protected List<LabeledVector> |
findKNearestNeighbors(Vector v)
The main idea is calculation all distance pairs between given vector and all vectors in training set, sorting
them and finding k vectors with min distance with the given vector.
|
<P> void |
saveModel(Exporter<KNNModelFormat,P> exporter,
P path)
Save model by the given path.
|
buildLabeledDatasetOnListOfVectors, copyParametersFrom, equals, getClassVoteForVector, getClassWithMaxVotes, getDistanceMeasure, getDistances, getKClosestVectors, hashCode, putDistanceIdxPair, toString, toString, withDistanceMeasure, withK, withStrategy
public KNNClassificationModel(Dataset<EmptyContext,LabeledVectorSet<Double,LabeledVector>> dataset)
dataset
- Specially prepared object to run algorithm over it.public <P> void saveModel(Exporter<KNNModelFormat,P> exporter, P path)
Exportable
saveModel
in interface Exportable<KNNModelFormat>
saveModel
in class NNClassificationModel
exporter
- Exporter.path
- Path to saved model.protected List<LabeledVector> findKNearestNeighbors(Vector v)
v
- The given vector.public void copyStateFrom(KNNClassificationModel mdl)
mdl
- Model.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019