TimeSeriesDBSCAN
DBSCAN for time series distances.
Interface to sklearn DBSCAN with sktime time series distances.
Time series distances are passed as the distance argument, which can be:
a string. This will substitute a hard-coded distance metric from
sktime.dists_kernels._numba_distances. These default distances are intended to be performant, but cannot deal with unequal length or multivariate series.a
sktimepairwise transformer. These are available insktime.dists_kernels, and can be discovered viaregistry.all_estimatorsby searching forpairwise-transformertype.and are composable first class citizens in thesktimeframework. Distances dealing with unequal length or multivariate series are available, these can be discovered viacapability:unequal_lengthandcapability:multivariatetags.a callable. The exact signature for callables is described below.
Quickstart
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
sktimepairwise transformer, must implement thepairwise-transformerinterface.sktimetransformers are available insktime.dists_kernels, and discoverable viaregistry.all_estimatorsby searching forpairwise-transformertype.if non-class callable, parameters can be passed via
distance_paramsif 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; ifdistance_mtypeis not set, must be able to takeX,X2which are ofpd_multiindexandnumpy3Dmtype
- 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.
Nonemeans 1 unless in ajoblib.parallel_backendcontext.-1means using all processors. See Glossary for more details.