spine.math.cluster

Numba JIT compiled implementation of clustering routines.

Functions

dbscan(x, eps[, min_samples, metric_id, p])

Runs DBSCAN on 3D points and returns the group assignments.

Classes

DBSCAN(*args, **kwargs)

Class-version of the Numba-accelerate dbscan() function.

class spine.math.cluster.DBSCAN(*args, **kwargs)[source]

Class-version of the Numba-accelerate dbscan() function.

eps

Distance scale (determines neighborhood)

Type:

float

min_samples

Minimum number of neighbors (including oneself) to be considered a core point

Type:

int

metric

Distance metric to be used to establish neighborhood

Type:

str

Methods

fit_predict(x)

Runs DBSCAN on 3D points and returns the group assignments.

class_type

class_type = jitclass.DBSCAN#79d09e88b190<eps:float32,min_samples:int64,metric_id:int64,p:float32>
spine.math.cluster.dbscan(x: ndarray, eps: float, min_samples: int = 1, metric_id: int = 2, p: float = 2.0) ndarray[source]

Runs DBSCAN on 3D points and returns the group assignments.

Parameters:
  • x (np.ndarray) – (N, 3) array of point coordinates

  • eps (float) – Distance below which two points are considered neighbors

  • min_samples (int) – Minimum number of neighbors for a point to be a core point

  • metric (str, default 'euclidean') – Distance metric used to compute pdist

  • p (float, default 2.) – p-norm factor for the Minkowski metric, if used

Returns:

(N,) Group assignments

Return type:

np.ndarray