timesfm-forecasting
Performs zero-shot time-series forecasting with Google's TimesFM, including regular-grid CSV preparation, quantile forecasts, XReg covariates, and held-out evaluation. Uses the Apache-licensed TimesFM 2.5 checkpoint by default and documents the distinct TimesFM 3.0 multivariate API and weight-licens
- 0
- Installs
- —
- Rating
- —
- Success rate
- 20
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 c5e625e4a251d1ea… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
TimesFM Forecasting
Choose the model/API first
The Python package version is 3.0.2; checkpoint versions are separate.
| Checkpoint | Interface | Quantile output | Usage terms |
|---|---|---|---|
| 2.5, 200M | timesfm.TimesFM_2p5_200M_torch, compile, forecast | mean + 9 deciles, median index 5 | Apache-2.0 weights; bundled CLI default |
| 3.0, about 330M | timesfm3.TimesFM3Forecaster, predict / predict_batch | 9 deciles, median index 4 | Downloaded weights restricted to non-commercial, non-production use |
Upstream identifies 3.0 as the latest model. This skill retains 2.5 as its default local workflow because its Apache-licensed weights have different usage terms. For 3.0 multivariate targets, past-only covariates or Apple MLX, read references/timesfm3.md before adapting code. Authorized Google Cloud services have separate terms; a Cloud entitlement does not change the license of downloaded weights. See the upstream license notice.
Use TimesFM for forecasting an ordered temporal target without task-specific model training. It is not a causal effect estimator, clinical detector, or physics-based climate model. Zero-shot describes fitting; it does not establish absence of benchmark overlap in pretraining or good accuracy in a new domain.
Workflow
- Establish cadence, units, forecast origin, horizon, known-at-origin covariates, evaluation cutoffs and a naive/seasonal-naive baseline.
- Validate a sorted, unique, regular time grid. Do not
dropna()internal gaps: that changes temporal spacing. Reject nonfinite inputs, or explicitly impute inside each training history. Never fill using held-out future targets. - Run
python scripts/check_system.pybefore downloading/loading weights. Its available-RAM and cache-volume thresholds are heuristics, not a guarantee against OOM. Start with batch size 1; measure actual peak usage. - Load the chosen checkpoint with a recorded immutable revision. For 2.5, compile explicit positive context/horizon settings; zero does not mean “use the maximum.” Keep patch-rounded context + horizon <=16,384 and horizon <=1,024 when using the continuous quantile head.
- Forecast, validate shapes/finite values/quantile ordering and export the forecast origin, frequency, configuration and checkpoint revision.
- Evaluate across rolling origins with preprocessing fitted independently per origin. Report accuracy, interval coverage and interval width by horizon; label quantile intervals nominal until calibrated on relevant data.
Installation
Run in a separate environment. The commands below target the reviewed release. Shell extras and version constraints must be quoted, particularly in zsh.
uv venv .venv-timesfm
uv pip install --python .venv-timesfm/bin/python "timesfm[torch]==3.0.2" numpy pandas
.venv-timesfm/bin/python scripts/check_system.py
Use the current PyTorch installation selector
for a CUDA wheel matching the host. The 2.5 loader in this release chooses
cuda:0 if CUDA exists, otherwise CPU; detecting MPS does not enable MPS
inference. Do not use model.to(...) on the wrapper as if it were an nn.Module.
For CPU-only XReg, install jax and scikit-learn alongside the PyTorch profile;
the upstream [xreg] extra requests jax[cuda], which is not appropriate for macOS.
Flax is a separate optional backend; it is not required by the bundled scripts.
from importlib.metadata import version
import timesfm
print(version("timesfm")) # package has no guaranteed timesfm.__version__
assert hasattr(timesfm, "TimesFM_2p5_200M_torch")
TimesFM 2.5 quick start
The checkpoint-load examples are illustrative: validation of this refresh used native package code with tiny random models and controlled decode fixtures, without downloading pretrained weights. That verifies mechanics, not accuracy.
import numpy as np
import timesfm
model = timesfm.TimesFM_2p5_200M_torch.from_pretrained(
"google/timesfm-2.5-200m-pytorch",
revision="1d952420fba87f3c6dee4f240de0f1a0fbc790e3",
torch_compile=False, # avoid compilation startup during an initial smoke run
)
model.compile(timesfm.ForecastConfig(
max_context=512, max_horizon=128, per_core_batch_size=1,
normalize_inputs=True, use_continuous_quantile_head=True,
force_flip_invariance=True, infer_is_positive=False,
fix_quantile_crossing=True,
))
histories = [np.sin(np.linspace(0, 20, 200)).astype(np.float32)]
# 2.5 may append dummy series to its input list during batching; pass a fresh list.
point, q = model.forecast(horizon=24, inputs=list(histories))
assert point.shape == (1, 24) and q.shape == (1, 24, 10)
assert np.isfinite(q).all() and np.all(np.diff(q[..., 1:], axis=-1) >= 0)
assert np.allclose(point, q[..., 5])
lower_80, upper_80 = q[..., 1], q[..., 9] # q10-q90: nominal 80% PI
lower_60, upper_60 = q[..., 2], q[..., 8] # q20-q80: nominal 60% PI
Set infer_is_positive=True only for a target domain that is truly nonnegative.
A positive observed window does not establish that temperature anomalies,
returns or residuals cannot become negative. Monotonic quantiles and a
continuous quantile head do not establish interval calibration.
CSV helper
python scripts/forecast_csv.py monthly_sales.csv \
--date-col date --freq MS --value-cols sales,revenue \
--horizon 12 --batch-size 1 --nonnegative --output forecasts.csv
forecast_csv.py validates before loading, sorts dates, rejects duplicate
headers/dates, checks the complete regular grid and preserves missing positions.
Missing values fail by default; --missing interpolate fills only internal gaps,
never leading/trailing values. Without --date-col, row order is assumed to be
the regular grid and output uses steps. Numeric IDs must be excluded using
--value-cols. --max-context controls history truncation; --horizon is limited
to 1..1,024 for this quantile-head workflow.
Outputs retain forecast, median, lower_80, upper_80, lower_60, upper_60.
A .metadata.json sidecar records origin, cadence, model revision and config.
Old skill releases mislabeled q10-q90/q20-q80 as 90%/80%; migrate old outer
*_90 to *_80 and old inner *_80 to *_60 simultaneously. Old generated
example forecasts were removed because their mapping/provenance was invalid.
Covariates and anomaly screening
For 2.5 XReg, compile return_backcast=True, retain targets and covariates on
identical grids and provide dynamic covariates over context and horizon.
"xreg + timesfm" fits regression on targets, then forecasts regression residuals.
"timesfm + xreg" forecasts first, then fits regression on backcast residuals.
The latter needs more than one input patch (32 observations). In package 3.0.2,
the implementation returns lists of combined point and quantile forecasts;
an inherited docstring incorrectly describes the second return as XReg-only.
See references/api_reference.md for the complete call.
Quantile exceedances may screen for unusual observations, but even calibrated 80% intervals exclude about 20% of ordinary observations marginally. They do not supply anomaly probabilities, familywise control or validated alarm severity. Retrospective detrended Z scores also differ from prospective anomaly detection.
References and examples
- API reference: 2.5 loader, compile, forecast and XReg contracts.
- Output/config: all real ForecastConfig fields and interval indexing.
- Data preparation: grid, missingness, covariate timing and format recipes.
- Workflows: held-out and rolling-origin validation, baseline comparisons.
- System requirements: resource checks and backend requirements.
- Performance tuning: measured batch/context tuning.
- Examples and validation: example commands and testing scope.
- TimesFM 3.0: multivariate API, 9-decile layout and usage boundary.
Primary review sources: official source, 3.0.2 distribution, 2.5 model card, 3.0 model card.
Files
20- SKILL.md
6f785fe73b9.3 KB - examples/anomaly-detection/detect_anomalies.py
b72da2b71217.5 KB - examples/covariates-forecasting/demo_covariates.py
58a1a831a918.6 KB - examples/global-temperature/README.md
85d4dc8a831.7 KB - examples/global-temperature/generate_animation_data.py
68aedbe20b2.6 KB - examples/global-temperature/generate_gif.py
0e5d0d0cdc7.2 KB - examples/global-temperature/generate_html.py
f4f600445021.4 KB - examples/global-temperature/run_example.sh
e4dca4db1f435 B - examples/global-temperature/run_forecast.py
e365895dbe2.6 KB - examples/global-temperature/visualize_forecast.py
fe718aff953.8 KB - references/api_reference.md
e56d8921fa6.1 KB - references/data_preparation.md
3bb3910e543.4 KB - references/examples_and_validation.md
8f2a1c53323.1 KB - references/output_and_config.md
3f261ac97c2.3 KB - references/performance_tuning.md
59a622f8251.7 KB - references/system_requirements.md
cd0d4612453.1 KB - references/timesfm3.md
9c43ae94284.2 KB - references/workflows.md
fc702f51532.7 KB - scripts/check_system.py
3fabbf00a316.5 KB - scripts/forecast_csv.py
1f2969934e11.0 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from K-Dense-AI/scientific-agent-skills8
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps, mfapy isotope simulation, constrained multistart fitting, and flux-profile diagnostics. Use for 13C-MFA, carbon tracing, mass isotopomer distributions (MDVs/MIDs), positional
Uses the Adaptyv Bio Foundry API and Python SDK to design protein characterization experiments, estimate costs, submit sequences, monitor laboratory progress, and retrieve results. Applies to Adaptyv Foundry, its target catalog, binding screening and affinity assays, thermostability, expression, flu
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorit
Looks up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), scores varia
Plans, executes, and documents validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and lig
Handles annotated matrices in single-cell analysis, .h5ad and Zarr files, and integration with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Applies Arbor Hypothesis Tree Refinement to research artifacts with repeatable evaluators, including model training, agent harnesses, data synthesis and benchmark optimization. Uses persistent hypotheses, isolated experiments, evidence propagation and held-out candidate comparison for multi-experime
Infers candidate gene regulatory networks from bulk or single-cell expression data using AertsLab Arboreto GRNBoost2 and GENIE3. Use for transcription factor-target association ranking, compatible Dask execution, sparse expression inputs, and network stability checks.
Related backend skillsscan passed
NestJS architecture patterns for modules, controllers, providers, DTO validation, guards, interceptors, config, and production-grade TypeScript backends. Use when building or reviewing a NestJS backend — modules, providers, DTO validation, guards, or interceptors.
Report browser/API/CLI/job/worker/webhook bugs. (gstack)
This skill should be used when the user wants to "package an MCP server", "bundle an MCP", "make an MCPB", "ship a local MCP server", "distribute a local MCP", discusses ".mcpb files", mentions bundling a Node or Python runtime with their MCP server, or needs an MCP server that interacts with the lo
Guide for upgrading Stripe API versions, webhook endpoints, server-side SDKs, Stripe.js, and mobile SDKs
PostHog integration for server-side Node.js applications using posthog-node
Throw typed errors with TRPCError and error codes (NOT_FOUND, UNAUTHORIZED, BAD_REQUEST, INTERNAL_SERVER_ERROR), configure errorFormatter for client-side Zod error display, handle errors globally with onError callback, map tRPC errors to HTTP status codes with getHTTPStatusCodeFromError().