计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
clustering【效率与协作】Guides PyPOTS clustering workflows with CRLI and VaDER, including cluster inputs, latent outputs, validation metrics, and checkpoint caveats.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user wants unsupervised cluster assignments for partially-observed time-series samples.
predict()[\"clustering\"]"../../references/data-formats.md#clustering for X and optional y.../../references/api-reference.md for cluster() and result keys.../../references/model-overview.md#clustering for model selection.../../references/troubleshooting.md for HDF5, checkpoint, and metric
failures.../cli/ for pypots-cli train, predict, evaluate, benchmark, or
recommend configs.This route covers:
CRLI clustering.VaDER clustering.X plus optional validation labels.predict()["clustering"] or cluster().return_latent_vars=True.Route elsewhere:
../classification/.../representation/.../anomaly-detection/.../cli/ plus
../../references/data-formats.md.Prepare train_set = {"X": train_X} with shape
[n_samples, n_steps, n_features].
Choose n_clusters; if labels exist, use them only for validation, not as
supervised training targets.
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.Train with fit(train_set, val_set).
Predict:
results = model.predict({"X": test_X}, return_latent_vars=True)
clusters = results["clustering"]
latents = results.get("latent_vars")
Evaluate against known labels with
calc_external_cluster_validation_metrics(). Use internal metrics only when
you pass the right latent representation or feature matrix.
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})
CRLI when you need explicit latent variables for downstream inspection.VaDER when its variational/deep-clustering assumptions fit the task,
but be prepared to retrain if Gaussian-mixture internals hit singular-matrix
issues.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.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.