Skip to content
Back to skills

Imputation

ASecurity

"Guides PyPOTS missing-value imputation workflows, including

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
testingpythonapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill imputation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Imputation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Imputation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-imputation/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-imputation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "imputation"
description: "Guides PyPOTS missing-value imputation workflows, including
  rule-based baselines, neural imputers, data keys, result handling, masks, and
  checkpoint behavior."
disable-model-invocation: true
metadata:
  disco-role: operating
license: BSD 3-Clause
---

# PyPOTS Imputation

Use this sub-skill when the user asks to fill, impute, interpolate, or evaluate
missing values in partially-observed multivariate time series with PyPOTS.

## Natural Triggers

- "impute missing values with PyPOTS"
- "use SAITS / BRITS / MRNN / USGAN"
- "compare Mean, Median, LOCF, and Lerp"
- "get `predict()[\"imputation\"]`"
- "evaluate imputed values with an indicating mask"
- "run imputation from an HDF5 file"

## First References

- Read [`../../references/data-formats.md`](../../references/data-formats.md) before creating `X`, `X_ori`, or HDF5
  files.
- Read [`../../references/api-reference.md`](../../references/api-reference.md) for result keys, helper methods,
  and representative constructor signatures.
- Read [`../../references/model-overview.md#imputation`](../../references/model-overview.md#imputation) for model-family choice.
- Read [`../../references/troubleshooting.md`](../../references/troubleshooting.md) when import, optional dependency,
  shape, key, or checkpoint errors appear.
- Run [`../../scripts/check_install.py`](../../scripts/check_install.py) as a safe import and model-catalog check.

## Scope

This route covers:

- Rule-based imputers: `Mean`, `Median`, `LOCF`, `Lerp`.
- Neural imputers: `SAITS`, `BRITS`, `MRNN`, `USGAN`, `CSAI`, `TEFN`, and
  related backbone-adapted families.
- Imputation result extraction through `predict()["imputation"]` or `impute()`.
- In-memory dict and HDF5 lazy-loading inputs.
- Missingness masks, `X_ori`, artificial missingness, and MSE/MAE evaluation.
- Checkpoint save/load behavior for stateful neural models.

Route elsewhere:

- Future-value prediction -> [`../forecasting/`](../forecasting/SKILL.md).
- Class labels or probabilities -> [`../classification/`](../classification/SKILL.md).
- Anomaly labels -> [`../anomaly-detection/`](../anomaly-detection/SKILL.md).
- CLI-only training or config generation -> [`../cli/`](../cli/SKILL.md).

## Core Workflow

1. Decide whether a no-training baseline is enough.
   - Use `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.
2. Build `test_set = {"X": X_with_nan}` with shape
   `[n_samples, n_steps, n_features]`.
3. For evaluation, also keep `X_ori` and compute an indicating mask over
   artificially hidden values.
4. For neural models, instantiate with architecture dimensions and training
   knobs such as `epochs`, `batch_size`, `optimizer`, `device`, and
   `saving_path`.
5. Call `fit(train_set, val_set)` when the model has a training phase.
6. Call `predict(test_set)` and read `results["imputation"]`; use `impute()`
   when you only need the imputed array.
7. Evaluate with `pypots.nn.functional.calc_mse`, `calc_mae`, `calc_rmse`, or
   `calc_mre` and the appropriate mask.

## Minimal Example Shape

```python
from pypots.imputation import Mean

model = Mean()
results = model.predict({"X": X_with_nan})
imputed = results["imputation"]
```

For a trained neural imputer:

```python
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)
```

## Common Decision Points

- Use a rule-based imputer before a heavy model to verify data shapes.
- Prefer `device="cpu"` for deterministic smoke checks; switch to CUDA for
  speed only after the API path works.
- Do not assume that two task modules with the same class name accept the same
  constructor arguments.
- If a model requires multiple optimizers (`USGAN`), pass the correct optimizer
  field names instead of a single generic `optimizer`.
- Keep HDF5 input keys identical to the in-memory dict keys.

## Validation Signals

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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.