Skip to content
Back to skills

Clustering

ASecurity

"Cluster time series with TimeSeriesKMeans, KernelKMeans, KShape,

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
datadebuggingapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill clustering --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clustering?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clustering
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-clustering-faa8b5e2/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-clustering-faa8b5e2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clustering
description: "Cluster time series with TimeSeriesKMeans, KernelKMeans, KShape,
  TimeSeriesDBSCAN, and silhouette scoring."
disable-model-invocation: true
metadata:
  disco-role: operating
license: BSD 2-Clause
---

# Clustering

Use this sub-skill for tslearn clustering tasks on small or preprocessed time-series datasets.

Start here:

- [references/api-reference.md](references/api-reference.md)
- [references/workflows.md](references/workflows.md)
- [references/troubleshooting.md](references/troubleshooting.md)
- [scripts/clustering_smoke.py](scripts/clustering_smoke.py)

Route here for:

- `TimeSeriesKMeans` with `metric="euclidean"`, `"dtw"`, or `"softdtw"`.
- `KernelKMeans` with the GAK kernel or another pairwise-kernel metric.
- `KShape` on equal-length, mean-variance-normalized series.
- `TimeSeriesDBSCAN` with `dtw`, `ctw`, `frechet`, `softdtw_normalized`, `euclidean`, or `precomputed`.
- `silhouette_score` and other clustering-only score checks.
- `EmptyClusterError`, `TimeSeriesCentroidBasedClusteringMixin`, and centroid-utility debugging.

Do not handle here:

- Generic metric and backend explanations: [metrics-backends](../metrics-backends/)
- Scaling, resampling, imputation, and ragged-to-dense prep: [data-preparation](../data-preparation/)
- Supervised models: [supervised-models](../supervised-models/)
- Forecasting: [forecasting](../forecasting/)
- Serialization or persistence: [analysis-and-persistence](../analysis-and-persistence/)
- Matrix profile: return to the [tslearn router](../../SKILL.md)

Operating rules:

1. Choose the estimator by geometry and centroid need.
   - Need explicit centroids? Use `TimeSeriesKMeans` or `KShape`.
   - Need assignments only? Use `KernelKMeans` or `TimeSeriesDBSCAN`.
2. Keep centroid semantics straight.
   - `TimeSeriesKMeans.cluster_centers_` are barycenters: Euclidean means, DTW DBA, or Soft-DTW barycenters.
   - `KShape.cluster_centers_` are shape centroids after mean-variance scaling.
   - `KernelKMeans` and `TimeSeriesDBSCAN` do not produce centroids; DBSCAN exposes `components_` and `core_ts_indices_` instead.
3. Use `fit_predict` for the training set and `predict` only on estimators that implement it.
   - `TimeSeriesDBSCAN` is fit-only; there is no out-of-sample `predict`.
4. For variable-length series, prefer `TimeSeriesKMeans(metric="dtw"|"softdtw")`, `KernelKMeans` with GAK, or `TimeSeriesDBSCAN` with a supported metric.
   - `euclidean` KMeans, `KShape`, and Euclidean DBSCAN expect equal-length series.
5. Fix `random_state` and increase `n_init` on tiny datasets.
   - If a run ends without fitted attributes, lower `n_clusters`, adjust `init`, or improve the metric parameters.
6. Use `silhouette_score` with the same geometry you want to validate.
   - Pass `metric="precomputed"` only when `X` is already a square distance matrix.
   - For `metric="softdtw"`, pass the same `gamma` in `metric_params`.

If the task is outside clustering, return to the [tslearn router](../../SKILL.md).

Files in this skill

  • SKILL.md2.9 KB
  • references/api-reference.md4.3 KB
  • references/troubleshooting.md2.9 KB
  • references/workflows.md3.8 KB
  • scripts/clustering_smoke.py4.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.