turicreate.nearest_neighbor_classifier.NearestNeighborClassifier

class turicreate.nearest_neighbor_classifier.NearestNeighborClassifier(knn_model, state=None)

Nearest neighbor classifier model. Nearest neighbor classifiers predict the class of any observation to be the most common class among the observation’s closest neighbors.

This model should not be constructed directly. Instead, use turicreate.nearest_neighbor_classifier.create() to create an instance of this model.

Methods

NearestNeighborClassifier.classify(self, dataset) Return the predicted class for each observation in dataset.
NearestNeighborClassifier.evaluate(self, dataset) Evaluate the model’s predictive accuracy.
NearestNeighborClassifier.name(self) Returns the name of the model.
NearestNeighborClassifier.predict(self, dataset) Return predicted class labels for instances in dataset.
NearestNeighborClassifier.predict_topk(self, …) Return top-k most likely predictions for each observation in dataset.
NearestNeighborClassifier.save(self, location) Save the model.
NearestNeighborClassifier.summary(self[, output]) Print a summary of the model.