STDBSCAN
STDBSCAN
- class STDBSCAN(eps1=0.5, eps2=10, min_samples=5, metric='euclidean', sparse_matrix_threshold=20000, frame_size=None, frame_overlap=None, n_jobs=-1)[source]
Spatio-temporal DBSCAN clustering.
Implementation of STDBSCAN by Birant et al [1]. Partially based on the implementation of Cakmak et al [3].
Clusters data based on specified spatial and temporal proximity thresholds.
Assumes that all variables are spatial coordinates.
- Parameters:
- 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.
- Attributes:
- labels_np.ndarray of shape (n_samples,)
Cluster labels for each point; noise is labeled as -1.
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).
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_
Methods
check_is_fitted([method_name])Check if the estimator has been fitted.
clone()Obtain a clone of the object with same hyper-parameters and config.
clone_tags(estimator[, tag_names])Clone tags from another object as dynamic override.
create_test_instance([parameter_set])Construct an instance of the class, using first test parameter set.
create_test_instances_and_names([parameter_set])Create list of all test instances and a list of names for them.
fit(X[, y])Fit time series clusterer to training data.
fit_predict(X[, y])Compute cluster centers and predict cluster index for each time series.
get_class_tag(tag_name[, tag_value_default])Get class tag value from class, with tag level inheritance from parents.
get_class_tags()Get class tags from class, with tag level inheritance from parent classes.
get_config()Get config flags for self.
get_fitted_params([deep])Get fitted parameters.
get_param_defaults()Get object's parameter defaults.
get_param_names([sort])Get object's parameter names.
get_params([deep])Get a dict of parameters values for this object.
get_tag(tag_name[, tag_value_default, ...])Get tag value from instance, with tag level inheritance and overrides.
get_tags()Get tags from instance, with tag level inheritance and overrides.
get_test_params([parameter_set])Return testing parameter settings for the estimator.
is_composite()Check if the object is composed of other BaseObjects.
load_from_path(serial)Load object from file location.
load_from_serial(serial)Load object from serialized memory container.
predict(X[, y])Predict the closest cluster each sample in X belongs to.
predict_proba(X)Predicts labels probabilities for sequences in X.
reset()Reset the object to a clean post-init state.
save([path, serialization_format])Save serialized self to bytes-like object or to (.zip) file.
score(X[, y])Score the quality of the clusterer.
set_config(**config_dict)Set config flags to given values.
set_params(**params)Set the parameters of this object.
set_random_state([random_state, deep, ...])Set random_state pseudo-random seed parameters for self.
set_tags(**tag_dict)Set instance level tag overrides to given values.

