npx skills add ...
npx skills add k-dense-ai/scientific-agent-skills --skill timesfm-forecasting
Zero-shot time series forecasting with Google's TimesFM foundation model. Use for any univariate time series (sales, sensors, energy, vitals, weather) without training a custom model. Supports CSV/DataFrame/array inputs with point forecasts and prediction intervals. Includes a preflight system checker script to verify RAM/GPU before first use.
npx skills add k-dense-ai/scientific-agent-skills --skill timesfm-forecasting
TimesFM (Time Series Foundation Model) is a pretrained decoder-only foundation model developed by Google Research for time-series forecasting. It works zero-shot — feed it any univariate time series and it returns point forecasts with calibrated quantile prediction intervals, no training required.
This skill wraps TimesFM for safe, agent-friendly local inference. It includes a mandatory preflight system checker that verifies RAM, GPU memory, and disk space before the model is ever loaded so the agent never crashes a user's machine.
Key numbers: TimesFM 2.5 uses 200M parameters (~800 MB on disk, ~1.5 GB in RAM on CPU, ~1 GB VRAM on GPU). The archived v1/v2 500M-parameter model needs ~32 GB RAM. Always run the system checker first.
Use this skill when:
Do not use this skill when:
statsmodelsaeonstatsmodelsscikit-learnNote on Anomaly Detection: TimesFM does not have built-in anomaly detection, but you can use the quantile forecasts as prediction intervals — values outside the 90% CI (q10–q90) are statistically unusual. See the
examples/anomaly-detection/directory for a full example.
CRITICAL — ALWAYS run the system checker before loading the model for the first time.
This script checks:
timesfm and torch are installedNote: Model weights are NOT stored in this repository. TimesFM weights (~800 MB) download on-demand from HuggingFace on first use and cache in
~/.cache/huggingface/. The preflight checker ensures sufficient resources before any download begins.
| Model | Parameters | RAM (CPU) | VRAM (GPU) | Disk | Context |
|---|---|---|---|---|---|
| TimesFM 2.5 (recommended) | 200M | ≥ 4 GB | ≥ 2 GB | ~800 MB | up to 16,384 |
| TimesFM 2.0 (archived) | 500M | ≥ 16 GB | ≥ 8 GB | ~2 GB | up to 2,048 |
| TimesFM 1.0 (archived) | 200M | ≥ 8 GB | ≥ 4 GB | ~800 MB | up to 2,048 |
Recommendation: Always use TimesFM 2.5 unless you have a specific reason to use an older checkpoint. It is smaller, faster, and supports 8× longer context.
TimesFM 2.5+ supports exogenous variables through forecast_with_covariates(). Requires timesfm[xreg].
| Covariate Type | Description | Example |
|---|---|---|
dynamic_numerical | Time-varying numeric | price, temperature, promotion spend |
dynamic_categorical | Time-varying categorical | holiday flag, day of week |
static_numerical | Per-series numeric | store size, account age |
static_categorical | Per-series categorical | store type, region, product category |
XReg Modes:
"xreg + timesfm" (default): TimesFM forecasts first, then XReg adjusts residuals"timesfm + xreg": XReg fits first, then TimesFM forecasts residualsSee
examples/covariates-forecasting/for a complete example with synthetic retail data.
TimesFM does not have built-in anomaly detection, but the quantile forecasts naturally provide prediction intervals that can detect anomalies:
| Severity | Condition | Interpretation |
|---|---|---|
| Normal | Inside 80% CI | Expected behavior |
| Warning | Outside 80% CI | Unusual but possible |
| Critical | Outside 90% CI | Statistically rare (< 10% probability) |
See
examples/anomaly-detection/for a complete example with visualization.
ForecastConfig field.per_core_batch_size by available memory, and memory management.statsmodelsUse statsmodels for classical models (ARIMA, SARIMAX) as a comparison baseline:
matplotlib / scientific-visualizationPlot forecasts with prediction intervals as publication-quality figures.
exploratory-data-analysisRun EDA on the time series before forecasting to understand trends, seasonality, and stationarity.
scripts/check_system.pyMandatory preflight checker. Run before first model load.
Output example:
scripts/forecast_csv.pyEnd-to-end CSV forecasting with automatic system check.
Detailed guides in references/:
| File | Contents |
|---|---|
references/system_requirements.md | Hardware tiers, GPU/CPU selection, memory estimation formulas |
references/api_reference.md | Full ForecastConfig docs, from_pretrained options, output shapes |
references/data_preparation.md | Input formats, NaN handling, CSV loading, covariate setup |
check_system.py first.model.compile() → RuntimeError: Model is not compiled. Must call compile() before forecast().normalize_inputs=True → unstable forecasts for series with large values.fix_quantile_crossing=True → quantiles may not be monotonic (q10 > q50).per_core_batch_size on small GPU → CUDA OOM. Start small, increase.torch.set_float32_matmul_precision("high") → slower inference on Ampere+ GPUs.np.isnan(point).any().infer_is_positive=True for series that can be negative → clamps forecasts at zero. Set False for temperature, returns, etc.| Version | Params | Context | Quantile Head | Frequency Flag | Status |
|---|---|---|---|---|---|
| 2.5 | 200M | 16,384 | ✅ Continuous (30M) | ❌ Removed | Latest |
| 2.0 | 500M | 2,048 | ✅ Fixed buckets | ✅ Required | Archived |
| 1.0 | 200M | 2,048 | ✅ Fixed buckets | ✅ Required | Archived |
Hugging Face checkpoints:
google/timesfm-2.5-200m-pytorch (recommended)google/timesfm-2.5-200m-flaxgoogle/timesfm-2.0-500m-pytorch (archived)google/timesfm-1.0-200m-pytorch (archived)