技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
imputation【数据与研究】Guides PyPOTS missing-value imputation workflows, including rule-based baselines, neural imputers, data keys, result handling, masks, and checkpoint behavior.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user asks to fill, impute, interpolate, or evaluate missing values in partially-observed multivariate time series with PyPOTS.
predict()[\"imputation\"]"../../references/data-formats.md before creating X, X_ori, or HDF5
files.../../references/api-reference.md for result keys, helper methods,
and representative constructor signatures.../../references/model-overview.md#imputation for model-family choice.../../references/troubleshooting.md when import, optional dependency,
shape, key, or checkpoint errors appear.../../scripts/check_install.py as a safe import and model-catalog check.This route covers:
Mean, Median, LOCF, Lerp.SAITS, BRITS, MRNN, USGAN, CSAI, TEFN, and
related backbone-adapted families.predict()["imputation"] or impute().X_ori, artificial missingness, and MSE/MAE evaluation.Route elsewhere:
../forecasting/.../classification/.../anomaly-detection/.../cli/.Mean, Median, LOCF, or Lerp for quick baselines and install
smoke checks.LOCF(first_step_imputation=...) accepts "zero", "backward",
"median", or "nan"-style first-step handling in native tests.test_set = {"X": X_with_nan} with shape
[n_samples, n_steps, n_features].X_ori and compute an indicating mask over
artificially hidden values.epochs, batch_size, optimizer, device, and
saving_path.fit(train_set, val_set) when the model has a training phase.predict(test_set) and read results["imputation"]; use impute()
when you only need the imputed array.pypots.nn.functional.calc_mse, calc_mae, calc_rmse, or
calc_mre and the appropriate mask.from pypots.imputation import Mean
model = Mean()
results = model.predict({"X": X_with_nan})
imputed = results["imputation"]
For a trained neural imputer:
from pypots.imputation import SAITS
model = SAITS(
n_steps=n_steps,
n_features=n_features,
n_layers=1,
d_model=8,
n_heads=1,
d_k=8,
d_v=8,
d_ffn=8,
epochs=1,
device="cpu",
)
model.fit(train_set, val_set)
imputed = model.impute(test_set)
device="cpu" for deterministic smoke checks; switch to CUDA for
speed only after the API path works.USGAN), pass the correct optimizer
field names instead of a single generic optimizer.A successful imputation workflow returns an array with the same leading shape as
X, contains no unexpected NaN values, and computes metrics only on intended
missing positions.