Skip to content

strata.neighbors

Distance metrics (Euclidean, Manhattan, Chebyshev, Minkowski, Cosine), nearest neighbors search, and k-NN classification and regression.


Struct Description
NeighborDistIdx Container holding a sample distance and its training dataset row index.
NearestNeighbors Unsupervised learner for implementing neighbor searches.
KNeighborsClassifier Classifier implementing the k-nearest neighbors vote.
KNeighborsRegressor Regression based on k-nearest neighbors.
KDNode Contiguous node in a flat KD-Tree buffer.
KDTree Fast spatial index for nearest neighbor and radius queries in low dimensions.
Function Description
sqeuclidean_distance Compute the squared Euclidean distance between row X[row_x] and row Y[row_y].
euclidean_distance Compute the Euclidean (L2L_2) distance between row X[row_x] and row Y[row_y].
manhattan_distance Compute the Manhattan (L1L_1 / taxicab / cityblock) distance between row X[row_x] and row Y[row_y].
chebyshev_distance Compute the Chebyshev (L∞L_\infty / max) distance between row X[row_x] and row Y[row_y].
minkowski_distance Compute the Minkowski (LpL_p) distance between row X[row_x] and row Y[row_y].
cosine_distance Compute the Cosine distance between row X[row_x] and row Y[row_y].
row_distance Compute pairwise distance between sample row X[row_x] and sample row Y[row_y] under metric.
pairwise_distances Compute the full pairwise distance matrix between rows of X and rows of Y.