spine.math.neighbors

Numba JIT compiled implementation of neighbor query routines.

In particular, this module supports: - Radius-based neighbor classification - kNN-based neighbor classification

Classes

KNeighborsClassifier(*args, **kwargs)

Class which assigns labels to points based on a nearest neighbor majority vote.

RadiusNeighborsClassifier(*args, **kwargs)

Class which assigns labels to points based on radial neighborhood majority vote.

class spine.math.neighbors.RadiusNeighborsClassifier(*args, **kwargs)[source]

Class which assigns labels to points based on radial neighborhood majority vote.

More specifically, for each point that is to be labeled: - Find all labeled points within some radius R; - Label the point based on majority vote.

If there are no labeled points in the neighborhood of a query point, a label of -1 is assigned to the query point.

Currently this is bruteforced with cdist, but in the future this is intended to be used with a KDTree backend for quicker query.

radius

Radius around which to check

Type:

float

metric_id

Distance metric enumerator

Type:

int

p

p-norm factor for the Minkowski metric, if used

Type:

float

iterate

Whether to recurse the search until no new labels are assigned

Type:

bool

Methods

fit_predict(X, y, Xq)

Assign labels to a set of points given a set of reference points.

class_type

class_type = jitclass.RadiusNeighborsClassifier#7dd0941db7d0<radius:float32,metric_id:int64,p:float32,iterate:bool>
class spine.math.neighbors.KNeighborsClassifier(*args, **kwargs)[source]

Class which assigns labels to points based on a nearest neighbor majority vote.

More specifically, for each point that is to be labeled: - Find the k closest labeled points; - Label the point based on majority vote.

If there are no labeled points in the neighborhood of a query point, a label of -1 is assigned to the query point.

Currently this is bruteforced with cdist, but in the future this is intended to be used with a KDTree backend for quicker query.

k

Number of neighbors to query

Type:

int

metric_id

Distance metric enumerator

Type:

int

p

p-norm factor for the Minkowski metric, if used

Type:

float

Methods

fit_predict(X, y, Xq)

Assign labels to a set of points given a set of reference points.

class_type

class_type = jitclass.KNeighborsClassifier#7dd0941f1cd0<k:int64,metric_id:int64,p:float32>