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.
The worst case memory complexity of DBSCAN is \(O({n}^2)\), which can occur when the eps
param is large and min\_samples
is low.
Read more in the User Guide.
new DBSCAN(opts?: object): DBSCAN;
Name | Type | Description |
---|---|---|
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? |
number |
The 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? |
number |
Leaf 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? |
any |
The 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? |
any |
Additional keyword arguments for the metric function. |
opts.min_samples? |
number |
The number of samples (or total weight) in a neighborhood for a point to be considered as a core point. This includes the point itself. If min\_samples is set to a higher value, DBSCAN will find denser clusters, whereas if it is set to a lower value, the found clusters will be more sparse. Default Value 5 |
opts.n_jobs? |
number |
The number of parallel jobs to run. undefined means 1 unless in a joblib.parallel\_backend context. \-1 means using all processors. See Glossary for more details. |
opts.p? |
number |
The power of the Minkowski metric to be used to calculate distance between points. If undefined , then p=2 (equivalent to the Euclidean distance). |
Defined in: generated/cluster/DBSCAN.ts:27
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/cluster/DBSCAN.ts:142
Perform DBSCAN clustering from features, or distance matrix.
fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
any |
Training 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? |
ArrayLike |
Weight 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? |
any |
Not used, present here for API consistency by convention. |
Promise
<any
>
Defined in: generated/cluster/DBSCAN.ts:159
Compute clusters from a data or distance matrix and predict labels.
fit_predict(opts: object): Promise<ArrayLike>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
any |
Training 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? |
ArrayLike |
Weight 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? |
any |
Not used, present here for API consistency by convention. |
Promise
<ArrayLike
>
Defined in: generated/cluster/DBSCAN.ts:206
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/cluster/DBSCAN.ts:255
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/cluster/DBSCAN.ts:95
Request metadata passed to the fit
method.
Note that this method is only relevant if enable\_metadata\_routing=True
(see sklearn.set\_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
set_fit_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.sample_weight? |
string | boolean |
Metadata routing for sample\_weight parameter in fit . |
Promise
<any
>
Defined in: generated/cluster/DBSCAN.ts:292
boolean
=false
Defined in: generated/cluster/DBSCAN.ts:25
boolean
=false
Defined in: generated/cluster/DBSCAN.ts:24
PythonBridge
Defined in: generated/cluster/DBSCAN.ts:23
string
Defined in: generated/cluster/DBSCAN.ts:20
any
Defined in: generated/cluster/DBSCAN.ts:21
Copy of each core sample found by training.
components_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/cluster/DBSCAN.ts:350
Indices of core samples.
core_sample_indices_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/cluster/DBSCAN.ts:325
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/cluster/DBSCAN.ts:418
Cluster labels for each point in the dataset given to fit(). Noisy samples are given the label -1.
labels_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/cluster/DBSCAN.ts:373
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/cluster/DBSCAN.ts:395
py(): PythonBridge;
PythonBridge
Defined in: generated/cluster/DBSCAN.ts:82
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/cluster/DBSCAN.ts:86