인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
생산성 및 협업 · SKILL.md

clustering

clustering

Guides PyPOTS clustering workflows with CRLI and VaDER, including cluster inputs, latent outputs, validation metrics, and checkpoint caveats.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: "clustering" description: "Guides PyPOTS clustering workflows with CRLI and VaDER, including cluster inputs, latent outputs, validation metrics, and checkpoint caveats." disable-model-invocation: true metadata: disco-role: operating license: BSD 3-Clause

PyPOTS Clustering

Use this sub-skill when the user wants unsupervised cluster assignments for partially-observed time-series samples.

Natural Triggers

  • "cluster time series with PyPOTS"
  • "use CRLI or VaDER"
  • "get predict()[\"clustering\"]"
  • "return latent variables from clustering"
  • "compute clustering validation metrics"
  • "why did VaDER hit a singular matrix?"

First References

Scope

This route covers:

  • CRLI clustering.
  • VaDER clustering.
  • Training with unlabeled X plus optional validation labels.
  • Cluster extraction through predict()["clustering"] or cluster().
  • Latent-variable extraction with return_latent_vars=True.
  • External and internal validation metrics.

Route elsewhere:

Core Workflow

  1. Prepare train_set = {"X": train_X} with shape [n_samples, n_steps, n_features].

  2. Choose n_clusters; if labels exist, use them only for validation, not as supervised training targets.

  3. Instantiate the model:

    • CRLI needs n_generator_layers, rnn_hidden_size, and rnn_cell_type.
    • VaDER needs rnn_hidden_size, d_mu_stddev, and often pretrain_epochs.
  4. Train with fit(train_set, val_set).

  5. Predict:

    results = model.predict({"X": test_X}, return_latent_vars=True)
    clusters = results["clustering"]
    latents = results.get("latent_vars")
    
  6. Evaluate against known labels with calc_external_cluster_validation_metrics(). Use internal metrics only when you pass the right latent representation or feature matrix.

Minimal Example Shape

from pypots.clustering import CRLI

model = CRLI(
    n_steps=n_steps,
    n_features=n_features,
    n_clusters=n_clusters,
    n_generator_layers=1,
    rnn_hidden_size=32,
    rnn_cell_type="GRU",
    epochs=1,
    device="cpu",
)
model.fit({"X": train_X}, {"X": val_X})
clusters = model.cluster({"X": test_X})

Common Decision Points

  • Use CRLI when you need explicit latent variables for downstream inspection.
  • Use VaDER when its variational/deep-clustering assumptions fit the task, but be prepared to retrain if Gaussian-mixture internals hit singular-matrix issues.
  • For fast checks, reduce epochs and pretrain_epochs; avoid interpreting metrics from tiny fixtures as benchmark quality.
  • CRLI uses generator/discriminator optimizers (G_optimizer, D_optimizer) rather than one generic optimizer.
  • If class labels are present, keep them out of training data unless the chosen API explicitly asks for validation labels.

Validation Signals

A successful clustering workflow returns one cluster id per test sample. Native style checks log external metrics such as Rand index, adjusted Rand index, NMI, and cluster purity, and may log internal metrics from latent variables.

저장한 Skills