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