Trees  Indices  Help 



Code for doing knearestneighbors classification.
k Nearest Neighbors is a supervised learning algorithm that classifies a new observation based the classes in its surrounding neighborhood.


kNN Holds information necessary to do nearest neighbors classification. 


1 


kNN 







__package__ =


calculate(knn, x[, weight_fn][, distance_fn]) > weight dict Calculate the probability for each class. knn is a kNN object. x is the observed data. weight_fn is an optional function that takes x and a training example, and returns a weight. distance_fn is an optional function that takes two points and returns the distance between them. If distance_fn is None (the default), the Euclidean distance is used. Returns a dictionary of the class to the weight given to the class. 
classify(knn, x[, weight_fn][, distance_fn]) > class Classify an observation into a class. If not specified, weight_fn will give all neighbors equal weight. distance_fn is an optional function that takes two points and returns the distance between them. If distance_fn is None (the default), the Euclidean distance is used. 
Trees  Indices  Help 


Generated by Epydoc 3.0.1 on Mon Jul 10 15:14:20 2017  http://epydoc.sourceforge.net 