timesfm-forecasting
정보
이 Claude Skill은 Google의 TimesFM 모델을 사용한 제로샷 시계열 예측을 수행하며, CSV 데이터 준비, 분위수 예측, 외부 회귀 변수 처리를 지원합니다. 기본적으로 Apache 라이선스의 TimesFM 2.5 체크포인트를 사용하며, 새로운 다변량 TimesFM 3.0 API에 대한 정보도 제공합니다. 평가 및 공변량 지원이 포함된 빠르고 코드 없이 사용할 수 있는 예측이 필요할 때 활용하세요.
빠른 설치
Claude Code
추천npx skills add K-Dense-AI/claude-scientific-skills -a claude-code/plugin add https://github.com/K-Dense-AI/claude-scientific-skillsgit clone https://github.com/K-Dense-AI/claude-scientific-skills.git ~/.claude/skills/timesfm-forecastingClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
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.
GitHub 저장소
자주 묻는 질문
timesfm-forecasting Skill이란 무엇인가요?
timesfm-forecasting은(는) K-Dense-AI이(가) 만든 Claude Skill입니다. Skill은 Claude가 필요할 때 불러오는 지침과 리소스를 묶어 추가 프롬프트 없이 timesfm-forecasting 관련 작업을 수행할 수 있게 합니다.
timesfm-forecasting은(는) 어떻게 설치하나요?
이 페이지의 설치 명령을 사용하세요. timesfm-forecasting을(를) Claude Code 플러그인으로 추가하거나 저장소를 skills 디렉터리에 복제한 다음 Claude를 다시 시작해 Skill을 불러옵니다.
timesfm-forecasting은(는) 어떤 카테고리에 속하나요?
timesfm-forecasting은(는) 디자인 카테고리에 속합니다.
timesfm-forecasting은(는) 무료로 사용할 수 있나요?
네. timesfm-forecasting은(는) AIMCP에 등록되어 있으며 무료로 설치할 수 있습니다.
연관 스킬
executing-plans 스킬은 검토 체크포인트가 포함된 통제된 배치로 실행할 완전한 구현 계획이 있을 때 사용합니다. 이 스킬은 계획을 불러와 비판적으로 검토한 후, 소규모 배치(기본값 3개 작업)로 작업을 실행하면서 각 배치 사이에 진행 상황을 아키텍트 검토를 위해 보고합니다. 이를 통해 내재된 품질 관리 체크포인트를 갖춘 체계적인 구현이 보장됩니다.
이 스킬은 코드 변경 사항을 요구 사항에 따라 분석하기 위해 코드 리뷰어 하위 에이전트를 호출합니다. 작업 완료 후, 주요 기능 구현 후, 또는 메인 브랜치에 병합하기 전에 사용해야 합니다. 이 리뷰는 현재 구현체와 원래 계획을 비교하여 문제를 조기에 발견하는 데 도움이 됩니다.
이 스킬은 개발자들이 HTTP, stdio 또는 SSE 전송 방식을 통해 MCP 서버를 Claude Code에 연결하는 포괄적인 가이드를 제공합니다. GitHub, Notion 및 사용자 정의 API와 같은 외부 서비스를 통합하기 위한 설치, 구성, 인증 및 보안을 다룹니다. MCP 통합 설정, 외부 도구 구성 또는 Claude의 모델 컨텍스트 프로토콜 작업 시 활용하세요.
이 스킬은 작업 분석을 기반으로 개발자가 Claude Code 웹 인터페이스와 CLI 인터페이스 중 선택할 수 있도록 돕고, 두 환경 간 원활한 세션 텔레포트를 가능하게 합니다. 웹, CLI 또는 모바일 환경 전환 시 세션 상태와 컨텍스트를 관리하여 워크플로를 최적화합니다. 다양한 단계에서 서로 다른 도구가 필요한 복잡한 프로젝트에 사용하세요.
