Density based spatial clustering (DBSCAN)

../../../../_images/DBScan.svg

Finds core samples of high density and expands clusters from them. Good for data which contains clusters of similar density This model can be given to predict directly without using fit.

Documentation

Attributes

components_

Copy of each core sample found by training.

core_sample_indices_

Indices of core samples.

labels_

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

Definition

Output ports

model model

Model

Configuration

Algorithm (algorithm)

The algorithm to be used by the NearestNeighbors module to compute pointwise distances and find nearest neighbors. See NearestNeighbors module documentation for details.

Max distance between two samples (eps)

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.

Leaf size (for BallTree or cKDTree) (leaf_size)

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.

Metric (metric)

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.

Added in version 0.17: metric precomputed to accept precomputed sparse matrix.

Min samples for core point (min_samples)

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.

Number of jobs (n_jobs)

The number of parallel jobs to run. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See n_jobs for more details.

Minkowski metric power (p)

The power of the Minkowski metric to be used to calculate distance between points. If None, then p=2 (equivalent to the Euclidean distance).

Examples

Implementation

Some of the docstrings for this module have been automatically extracted from the scikit-learn library and are covered by their respective licenses.

class node_clustering2.DBScan[source]