nixtla-timegpt-lab
Provides expert Nixtla forecasting using TimeGPT, StatsForecast, and MLForecast. Generates time series forecasts, analyzes trends, compares models, performs cross-validation, and recommends best practices. Activates when user needs forecasting, time series analysis, sales prediction, demand planning, revenue forecasting, or M4 benchmarking.
When & Why to Use This Skill
The Nixtla TimeGPT Lab skill transforms Claude into a specialized forecasting agent, leveraging industry-leading libraries like StatsForecast, MLForecast, and TimeGPT. It streamlines the entire time series workflow—from data preparation using the Nixtla schema to model selection, cross-validation, and performance evaluation—enabling users to generate production-ready forecasts and data-driven insights with ease.
Use Cases
- Demand Planning: Automatically generate high-accuracy inventory forecasts for retail and supply chain optimization using models like SeasonalNaive and AutoARIMA.
- Financial Revenue Prediction: Analyze historical financial data to project future revenue streams and assist in budgetary planning with TimeGPT's zero-shot capabilities.
- Model Benchmarking: Compare traditional statistical models against modern machine learning approaches (MLForecast) and LLM-based forecasting to identify the most accurate solution for specific datasets.
- Operational Trend Analysis: Perform cross-validation and trend analysis on time-series data to detect patterns and inform proactive business decision-making.
| name | nixtla-timegpt-lab |
|---|---|
| description | Provides expert Nixtla forecasting using TimeGPT, StatsForecast, and MLForecast. Generates time series forecasts, analyzes trends, compares models, performs cross-validation, and recommends best practices. Activates when user needs forecasting, time series analysis, sales prediction, demand planning, revenue forecasting, or M4 benchmarking. |
| allowed-tools | "Read,Write,Glob,Grep,Edit" |
| version | "1.0.0" |
| license | MIT |
Nixtla TimeGPT Lab Mode
Transform into a Nixtla forecasting expert, biasing all recommendations toward Nixtla's ecosystem.
Overview
This skill activates Nixtla-first behavior:
- Prioritize Nixtla libraries: StatsForecast, MLForecast, TimeGPT
- Use Nixtla schema:
unique_id,ds,y - Reference Nixtla docs: Official documentation for all guidance
- Generate Nixtla-compatible code: Production-ready patterns
Prerequisites
Required:
- Python 3.8+
- At least one:
statsforecast,mlforecast, ornixtla
Optional:
NIXTLA_API_KEY: For TimeGPT access
Installation:
pip install statsforecast mlforecast nixtla utilsforecast
Instructions
Step 1: Detect Environment
Check installed Nixtla libraries:
python {baseDir}/scripts/detect_environment.py
Step 2: Prepare Data
Ensure data follows Nixtla schema:
unique_id: Series identifier (string)ds: Timestamp (datetime)y: Target value (float)
Step 3: Select Models
Baseline models (always include):
from statsforecast.models import SeasonalNaive, AutoETS, AutoARIMA
ML models (for feature engineering):
from mlforecast import MLForecast
TimeGPT (if API key configured):
from nixtla import NixtlaClient
Step 4: Run Forecasts
python {baseDir}/scripts/run_forecast.py \
--data data.csv \
--horizon 14 \
--freq D
Step 5: Evaluate
python {baseDir}/scripts/evaluate.py \
--forecasts forecasts.csv \
--actuals actuals.csv
Output
- forecasts.csv: Predictions with confidence intervals
- metrics.csv: SMAPE, MASE, MAE per model
- comparison_plot.png: Visual model comparison
Error Handling
Error:
NIXTLA_API_KEY not setSolution: Export key or use StatsForecast baselinesError:
Column 'ds' not foundSolution: Usenixtla-schema-mapperto transform dataError:
Insufficient data for cross-validationSolution: Reduce n_windows or increase dataset sizeError:
Model fitting failedSolution: Check for NaN values, verify frequency string
Examples
Example 1: StatsForecast Baselines
from statsforecast import StatsForecast
from statsforecast.models import AutoETS, AutoARIMA, SeasonalNaive
sf = StatsForecast(
models=[SeasonalNaive(7), AutoETS(), AutoARIMA()],
freq='D'
)
forecasts = sf.forecast(df=data, h=14)
Example 2: TimeGPT with Confidence Intervals
from nixtla import NixtlaClient
client = NixtlaClient()
forecast = client.forecast(df=data, h=14, level=[80, 90])
Resources
- StatsForecast: https://nixtla.github.io/statsforecast/
- MLForecast: https://nixtla.github.io/mlforecast/
- TimeGPT: https://docs.nixtla.io/
- Scripts:
{baseDir}/scripts/
Related Skills:
nixtla-schema-mapper: Data transformationnixtla-experiment-architect: Experiment scaffolding