技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
anomaly-detection【数据与研究】Guides PyPOTS anomaly-detection workflows, including detector inputs, anomaly-rate configuration, output keys, binary metrics, and backend/data pitfalls.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user wants PyPOTS to detect anomalous timesteps or samples in partially-observed time series.
anomaly_rate do?"predict()[\"anomaly_detection\"]"anomaly_y in tests?"../../references/data-formats.md#anomaly-detection for X,
anomaly_y, and CLI label caveats.../../references/api-reference.md for detector helpers and result
keys.../../references/model-overview.md#anomaly-detection for model-family
choice.../../references/troubleshooting.md for data, CUDA, checkpoint, and
result-key failures.../cli/ for CLI-driven train/predict/evaluate flows.This route covers:
TimesNet, TEFN, TimeMixer, Transformer,
FiLM, SegRNN, ImputeFormer, PatchTST, DLinear, SAITS,
iTransformer, Crossformer, Pyraformer, FEDformer, Informer,
ETSformer, NonstationaryTransformer, and TimeMixerPP.anomaly_rate handling.predict()["anomaly_detection"] or detect().Route elsewhere:
../imputation/.../forecasting/.../classification/.../representation/.X with shape [n_samples, n_steps, n_features].anomaly_rate in (0, 1) that matches expected anomaly density.n_steps, n_features, anomaly_rate, and
model-specific architecture fields.fit(train_set, val_set) where train/validation dicts contain at
least X; native fixtures also keep anomaly_y for metric checks.predict(test_set) and read results["anomaly_detection"], or
call detect(test_set).calc_acc and calc_precision_recall_f1 when ground-truth
anomaly labels are available.from pypots.anomaly_detection import TimesNet
model = TimesNet(
n_steps=n_steps,
n_features=n_features,
anomaly_rate=0.05,
n_layers=1,
top_k=1,
d_model=16,
d_ffn=16,
n_kernels=3,
epochs=1,
device="cpu",
)
model.fit({"X": train_X}, {"X": val_X})
anomalies = model.detect({"X": test_X})
If using native test-style labels, keep:
test_anomaly_y = dataset["test_anomaly_y"].flatten()
Then compare model outputs to those labels with the metric helpers.
0 < anomaly_rate < 1; the base detector asserts this range.anomaly_y; CLI evaluation currently checks binary targets through y.A successful anomaly workflow returns anomaly_detection and can compute finite
accuracy/precision/recall/F1 values against the chosen binary label array.