__init__(self,
points,
p=2,
is_distance=True)
(Constructor)
| source code
|
Construct a nearest neighbor algorithm.
- Parameters:
data - array of n points with dimensionality d, shape (n,d). The data
points to be indexed. This array is not copied, and so modifying
this data will result in bogus results.
p - float, 1<=p<=infinity Which Minkowski p-norm to use. 1 is
the sum-of-absolute-values "Manhattan" distance 2 is
the usual Euclidean distance infinity is the
maximum-coordinate-difference distance Also accepts the keywords
"Manhattan", "Euclidean", and
"Correlation", or p can also be a user defined function
with will compute a distance matrix between two sets of points.
is_distance - True or False. Determines if a user defined function is treated
as a distance (smaller is better) or a similarity (larger values
are better).
|