技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
forecasting【数据与研究】Guides PyPOTS forecasting workflows, including future-target data keys, forecaster selection, result extraction, evaluation metrics, and HDF5 lazy-loading.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user wants to predict future timesteps from a partially-observed time-series prefix with PyPOTS.
X_pred contain?"predict()[\"forecasting\"]"../../references/data-formats.md#forecasting before building X and
X_pred.../../references/api-reference.md for the forecast() helper and
representative constructor patterns.../../references/model-overview.md#forecasting for model-family choice.../../references/troubleshooting.md when constructor, shape, backend,
or HDF5 failures appear.../cli/ if the user wants pypots-cli train, predict, evaluate,
tune, or benchmark rather than direct Python calls.This route covers:
BTTF.TEFN, TimeMixer, TimesNet,
Transformer, FITS, DLinear, CSDI, GPT4TS, MOMENT, and TimeLLM.X_pred.predict()["forecasting"] or forecast().calc_mse, calc_mae, calc_rmse, and calc_mre.Route elsewhere:
../imputation/.../classification/.../anomaly-detection/.../representation/.Choose n_steps for the observed prefix and n_pred_steps for the target
future window.
Build train/validation/test dictionaries with X and X_pred:
train_set = {"X": train_X[:, :n_steps], "X_pred": train_X[:, n_steps:]}
val_set = {"X": val_X[:, :n_steps], "X_pred": val_X[:, n_steps:]}
test_set = {"X": test_X[:, :n_steps], "X_pred": test_X[:, n_steps:]}
Instantiate the model with n_steps, n_features, n_pred_steps, and
n_pred_features when the selected model requires those fields.
Train with model.fit(train_set, val_set) unless using a model whose
forecast path is non-neural or differently configured.
Predict with model.predict(test_set) and read results["forecasting"], or
call model.forecast(test_set).
Evaluate against X_pred, masking natural missing positions if needed.
from pypots.forecasting import TEFN
model = TEFN(
n_steps=n_steps,
n_features=n_features,
n_pred_steps=n_pred_steps,
n_pred_features=n_features,
n_fod=2,
epochs=1,
device="cpu",
)
model.fit(train_set, val_set)
forecast = model.forecast(test_set)
For BTTF, supply matrix-factorization fields such as rank, time_lags,
burn_iter, and gibbs_iter rather than the standard neural training knobs.
BTTF or a small neural model on a tiny fixture before running a
large benchmark.X_pred has the same number of samples as X.A successful forecasting workflow returns forecasting with shape compatible
with X_pred and finite regression metrics over the intended target positions.