Documentation
Classes
DBSCAN

DBSCAN

Perform DBSCAN clustering from vector array or distance matrix.

DBSCAN - Density-Based Spatial Clustering of Applications with Noise. Finds core samples of high density and expands clusters from them. Good for data which contains clusters of similar density.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new DBSCAN(opts?: object): DBSCAN;

Parameters

NameTypeDescription
opts?object-
opts.algorithm?"auto" | "ball_tree" | "kd_tree" | "brute"The algorithm to be used by the NearestNeighbors module to compute pointwise distances and find nearest neighbors. See NearestNeighbors module documentation for details. Default Value 'auto'
opts.eps?numberThe maximum distance between two samples for one to be considered as in the neighborhood of the other. This is not a maximum bound on the distances of points within a cluster. This is the most important DBSCAN parameter to choose appropriately for your data set and distance function. Default Value 0.5
opts.leaf_size?numberLeaf size passed to BallTree or cKDTree. This can affect the speed of the construction and query, as well as the memory required to store the tree. The optimal value depends on the nature of the problem. Default Value 30
opts.metric?anyThe metric to use when calculating distance between instances in a feature array. If metric is a string or callable, it must be one of the options allowed by sklearn.metrics.pairwise\_distances for its metric parameter. If metric is “precomputed”, X is assumed to be a distance matrix and must be square. X may be a sparse graph, in which case only “nonzero” elements may be considered neighbors for DBSCAN. Default Value 'euclidean'
opts.metric_params?anyAdditional keyword arguments for the metric function.
opts.min_samples?numberThe number of samples (or total weight) in a neighborhood for a point to be considered as a core point. This includes the point itself. Default Value 5
opts.n_jobs?numberThe number of parallel jobs to run. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all processors. See Glossary for more details.
opts.p?numberThe power of the Minkowski metric to be used to calculate distance between points. If undefined, then p=2 (equivalent to the Euclidean distance).

Returns

DBSCAN

Defined in: generated/cluster/DBSCAN.ts:25 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/cluster/DBSCAN.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/cluster/DBSCAN.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/cluster/DBSCAN.ts:21 (opens in a new tab)

id

string

Defined in: generated/cluster/DBSCAN.ts:18 (opens in a new tab)

opts

any

Defined in: generated/cluster/DBSCAN.ts:19 (opens in a new tab)

Accessors

components_

Copy of each core sample found by training.

Signature

components_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/cluster/DBSCAN.ts:276 (opens in a new tab)

core_sample_indices_

Indices of core samples.

Signature

core_sample_indices_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/cluster/DBSCAN.ts:251 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/cluster/DBSCAN.ts:344 (opens in a new tab)

labels_

Cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.

Signature

labels_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/cluster/DBSCAN.ts:299 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/cluster/DBSCAN.ts:321 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/cluster/DBSCAN.ts:80 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/cluster/DBSCAN.ts:84 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/cluster/DBSCAN.ts:140 (opens in a new tab)

fit()

Perform DBSCAN clustering from features, or distance matrix.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?anyTraining instances to cluster, or distances between instances if metric='precomputed'. If a sparse matrix is provided, it will be converted into a sparse csr\_matrix.
opts.sample_weight?ArrayLikeWeight of each sample, such that a sample with a weight of at least min\_samples is by itself a core sample; a sample with a negative weight may inhibit its eps-neighbor from being core. Note that weights are absolute, and default to 1.
opts.y?anyNot used, present here for API consistency by convention.

Returns

Promise<any>

Defined in: generated/cluster/DBSCAN.ts:157 (opens in a new tab)

fit_predict()

Compute clusters from a data or distance matrix and predict labels.

Signature

fit_predict(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?anyTraining instances to cluster, or distances between instances if metric='precomputed'. If a sparse matrix is provided, it will be converted into a sparse csr\_matrix.
opts.sample_weight?ArrayLikeWeight of each sample, such that a sample with a weight of at least min\_samples is by itself a core sample; a sample with a negative weight may inhibit its eps-neighbor from being core. Note that weights are absolute, and default to 1.
opts.y?anyNot used, present here for API consistency by convention.

Returns

Promise<ArrayLike>

Defined in: generated/cluster/DBSCAN.ts:204 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/cluster/DBSCAN.ts:93 (opens in a new tab)