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. 











__package__ =


Train a k nearest neighbors classifier on a training set. xs is a list of observations and ys is a list of the class assignments. Thus, xs and ys should contain the same number of elements. k is the number of neighbors that should be examined when doing the classification. 
Calculate the probability for each class.
Returns a dictionary of the class to the weight given to the 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 Fri Jun 22 16:34:28 2018  http://epydoc.sourceforge.net 