Clusterer
STDBSCAN
Spatio-temporal DBSCAN clustering.
Quickstart
python
from sktime.clustering.spatio_temporal import STDBSCAN
estimator = STDBSCAN(eps1=0.5, eps2=10, min_samples=5, metric='euclidean', sparse_matrix_threshold=20000, frame_size=None, frame_overlap=None, n_jobs=-1)Parameters(8)
- eps1float, default=0.5
- Maximum spatial distance for points to be considered related.
- eps2float, default=10
- Maximum temporal distance for points to be considered related [1].
- min_samplesint, default=5
- Minimum number of samples to form a core point.
- metricstr, default=’euclidean’
- Distance metric to use; options include ‘euclidean’, ‘manhattan’, ‘chebyshev’, etc.
- sparse_matrix_thresholdint, default=20_000
- Sets the limit on the number of samples for which the algorithm can efficiently compute distances with a full matrix approach. Datasets exceeding this threshold will be handled using sparse matrix methods.
- frame_sizefloat or None, default=None
- If not None the dataset is split into frames [2, 3]; The frame_size is the number of time points in a frame.
- frame_overlapfloat or None, default=eps2
- If frame_size is set - there will be an overlap between the frames to merge the clusters afterward [2, 3]; Only used if frame_size is not None.
- n_jobsint or None, default=-1
- Number of parallel jobs for distance computation; -1 uses all cores.
Examples
>>> from sktime.clustering.spatio_temporal import STDBSCAN
>>> from sktime.clustering.utils.toy_data_generation._make_moving_blobs import (
... make_moving_blobs)
>>> X, y_true = make_moving_blobs (n_times = 20)
>>> st_dbscan = STDBSCAN (
... eps1 = 0.5, eps2 = 3, min_samples = 5, metric = "euclidean", n_jobs =- 1
... )
>>> st_dbscan. fit (X)
>>> predicted_labels = st_dbscan. labels_References
- [1 ] Birant, D., & Kut, A. “ST-DBSCAN: An algorithm for clustering spatial-temporal data.” Data Knowl. Eng., vol. 60, no. 1, pp. 208-221, Jan. 2007, doi: [10.1016/j.datak.2006.01.013](https://doi.org/10.1016/j.datak.2006.01.013). [2 ] Peca, I., Fuchs, G., Vrotsou, K., Andrienko, N., and Andrienko, G., “Scalable Cluster Analysis of Spatial Events” 2012, The Eurographics Association doi: [10.2312/PE/EUROVAST/EUROVA12/019-023](https://doi.org/10.2312/PE/EUROVAST/EUROVA12/019-023). [3 ] Cakmak, E., Plank, M., Calovi, D. S., Jordan, A., & Keim, D. “Spatio-temporal clustering benchmark for collective animal behavior.” ACM, Nov. 2021, pp. 5-8. doi: [10.1145/3486637.3489487](https://doi.org/10.1145/3486637.3489487).