Back to models
Clusterer

TimeSeriesDBSCAN

DBSCAN for time series distances.

Quickstart

python
from sktime.clustering.dbscan import TimeSeriesDBSCAN

estimator = TimeSeriesDBSCAN(distance='euclidean', eps=0.5, min_samples=5, algorithm='auto', leaf_size=30, distance_params=None, n_jobs=None)

Parameters(7)

distancestr, sktime pairwise transformer, or callable, optional. default =’dtw’

distance measure between time series

  • if str, must be one of the following strings: ‘euclidean’, ‘squared’, ‘dtw’, ‘ddtw’, ‘wdtw’, ‘wddtw’, ‘lcss’, ‘edr’, ‘erp’, ‘msm’, ‘twe’ this will substitute a hard-coded distance metric from sktime.dists_kernels._numba_distances.

  • if sktime pairwise transformer, must implement the pairwise-transformer interface. sktime transformers are available in sktime.dists_kernels, and discoverable via registry.all_estimators by searching for pairwise-transformer type.

  • if non-class callable, parameters can be passed via distance_params

  • if any callable, must be of signature (X: Panel, X2: Panel) -> np.ndarray. The output must be mxn array if X is Panel of m Series, X2 of n Series; if distance_mtype is not set, must be able to take X, X2 which are of pd_multiindex and numpy3D mtype

epsfloat, default=0.5
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.
min_samplesint, default=5
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.
algorithm{‘auto’, ‘ball_tree’, ‘kd_tree’, ‘brute’}, default=’auto’
The algorithm to be used by the NearestNeighbors module to compute pointwise distances and find nearest neighbors. See NearestNeighbors module documentation for details.
leaf_sizeint, default=30
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.
distance_paramsdict, optional, default = None.
dictionary for distance parameters, in case that distance is a str or callable
n_jobsint, default=None

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