Nixtla Demo Generator
by intent-solutions-io
Generate production-ready Jupyter notebooks showcasing Nixtla forecasting workflows for statsforecast, mlforecast, and TimeGPT. Use when creating demos, building examples, or showcasing forecasting capabilities. Trigger with 'generate demo notebook', 'create Jupyter demo', or 'build forecasting example'.
Skill Details
Repository Files
7 files in this skill directory
name: nixtla-demo-generator description: "Generate production-ready Jupyter notebooks showcasing Nixtla forecasting workflows for statsforecast, mlforecast, and TimeGPT. Use when creating demos, building examples, or showcasing forecasting capabilities. Trigger with 'generate demo notebook', 'create Jupyter demo', or 'build forecasting example'." allowed-tools: "Write,Read,Glob,Bash(python:*)" version: "1.0.0" author: "Jeremy Longshore jeremy@intentsolutions.io" license: MIT
Nixtla Demo Generator
Generate interactive, production-ready Jupyter notebooks that showcase Nixtla forecasting workflows with complete data pipelines, model training, evaluation, and visualization.
Overview
This skill creates high-quality demonstration notebooks:
- Three library support: StatsForecast, MLForecast, TimeGPT
- Complete workflows: Data loading, preprocessing, model training, forecasting, evaluation, visualization
- Production patterns: Best practices, error handling, performance optimization
- Instant demos: Ready for Nixtla CEO presentations, customer POCs, and documentation
- Customizable templates: Modify for specific use cases and datasets
Prerequisites
Required:
- Python 3.8+
- Jupyter notebook (
pip install jupyter) - At least one Nixtla library:
statsforecast- Statistical models (ARIMA, ETS, etc.)mlforecast- Machine learning models (LightGBM, XGBoost)nixtla- TimeGPT API access
Optional:
NIXTLA_API_KEY: For TimeGPT demos- Sample datasets (M4, custom time series)
Installation:
pip install jupyter statsforecast mlforecast nixtla pandas matplotlib
Instructions
Step 1: Choose Library
Select which Nixtla library to demonstrate:
# Options: statsforecast, mlforecast, timegpt
export DEMO_LIBRARY=statsforecast
Step 2: Generate Notebook
Run the generator script:
python {baseDir}/scripts/generate_demo_notebook.py \
--library statsforecast \
--dataset m4-daily \
--output demo_statsforecast_m4.ipynb
Step 3: Customize (Optional)
Edit the generated notebook to:
- Add custom datasets
- Modify model configurations
- Adjust visualizations
- Include domain-specific context
Step 4: Execute Notebook
Run the generated notebook:
jupyter notebook demo_statsforecast_m4.ipynb
Or execute non-interactively:
jupyter nbconvert --to notebook --execute demo_statsforecast_m4.ipynb
Step 5: Export Results
Export to various formats:
# HTML for sharing
jupyter nbconvert --to html demo_statsforecast_m4.ipynb
# PDF for presentations
jupyter nbconvert --to pdf demo_statsforecast_m4.ipynb
# Python script for automation
jupyter nbconvert --to python demo_statsforecast_m4.ipynb
Output
- [library]_demo.ipynb: Complete Jupyter notebook with:
- Introduction and setup
- Data loading and exploration
- Model configuration
- Training and forecasting
- Evaluation metrics (SMAPE, MASE, MAE)
- Visualizations (forecasts, residuals, comparisons)
- Next steps and resources
Error Handling
-
Error:
ModuleNotFoundError: No module named 'statsforecast'Solution: Install required library:pip install statsforecast mlforecast nixtla -
Error:
NIXTLA_API_KEY not set(TimeGPT demos) Solution: Export API key:export NIXTLA_API_KEY=your_keyor skip TimeGPT demo -
Error:
Dataset file not foundSolution: Use--generate-sample-dataflag to create synthetic dataset -
Error:
nbformat.validator.ValidationErrorSolution: Check Jupyter version compatibility:pip install --upgrade jupyter nbformat -
Error:
Kernel died while executing notebookSolution: Reduce dataset size or increase memory allocation
Examples
Example 1: StatsForecast M4 Daily Demo
python {baseDir}/scripts/generate_demo_notebook.py \
--library statsforecast \
--dataset m4-daily \
--models AutoETS,AutoARIMA,SeasonalNaive \
--horizon 14 \
--output demo_statsforecast_m4_daily.ipynb
Generated notebook includes:
# Import libraries
from statsforecast import StatsForecast
from statsforecast.models import AutoETS, AutoARIMA, SeasonalNaive
import pandas as pd
import matplotlib.pyplot as plt
# Load M4 Daily data
df = pd.read_csv('m4_daily_sample.csv')
print(f"Loaded {len(df)} rows, {df['unique_id'].nunique()} series")
# Configure models
sf = StatsForecast(
models=[AutoETS(), AutoARIMA(), SeasonalNaive(season_length=7)],
freq='D',
n_jobs=-1
)
# Generate forecasts
forecasts = sf.forecast(df=df, h=14)
# Evaluate
from statsforecast.utils import calculate_metrics
metrics = calculate_metrics(df, forecasts, metrics=['smape', 'mase'])
print(metrics)
# Visualize
sf.plot(df, forecasts)
plt.show()
Example 2: MLForecast with Exogenous Features
python {baseDir}/scripts/generate_demo_notebook.py \
--library mlforecast \
--dataset retail-sales \
--models LightGBM,XGBoost \
--features lag,rolling_mean,date_features \
--output demo_mlforecast_retail.ipynb
Generated notebook features:
- Lag features (1, 7, 14 days)
- Rolling statistics (mean, std, min, max)
- Date features (day of week, month, is_weekend)
- LightGBM and XGBoost model comparison
- Feature importance plots
Example 3: TimeGPT API Demo
python {baseDir}/scripts/generate_demo_notebook.py \
--library timegpt \
--dataset custom \
--api-key $NIXTLA_API_KEY \
--horizon 30 \
--confidence-levels 80,90,95 \
--output demo_timegpt_api.ipynb
Generated notebook demonstrates:
- TimeGPT API client initialization
- Data upload and validation
- Forecast generation with confidence intervals
- Probabilistic forecasting
- Anomaly detection integration
Example 4: Batch Generate All Three Libraries
for library in statsforecast mlforecast timegpt; do
python {baseDir}/scripts/generate_demo_notebook.py \
--library $library \
--dataset m4-hourly \
--output "demo_${library}_m4_hourly.ipynb"
done
Example 5: Custom Template with Branding
python {baseDir}/scripts/generate_demo_notebook.py \
--library statsforecast \
--dataset m4-weekly \
--template {baseDir}/assets/templates/custom_branded_template.ipynb \
--logo company_logo.png \
--output demo_branded.ipynb
Resources
- StatsForecast Docs: https://nixtla.github.io/statsforecast/
- MLForecast Docs: https://nixtla.github.io/mlforecast/
- TimeGPT Docs: https://docs.nixtla.io/
- Jupyter Tutorial: https://jupyter.org/try
- M4 Competition: https://github.com/Mcompetitions/M4-methods
Related Skills:
nixtla-timegpt-lab: Interactive TimeGPT experimentationnixtla-experiment-architect: Multi-model experiment designnixtla-schema-mapper: Data transformation for Nixtla format
Scripts:
{baseDir}/scripts/generate_demo_notebook.py: Main notebook generator{baseDir}/assets/templates/statsforecast_template.ipynb: StatsForecast base template{baseDir}/assets/templates/mlforecast_template.ipynb: MLForecast base template{baseDir}/assets/templates/timegpt_template.ipynb: TimeGPT base template
Related Skills
Dask
Parallel/distributed computing. Scale pandas/NumPy beyond memory, parallel DataFrames/Arrays, multi-file processing, task graphs, for larger-than-RAM datasets and parallel workflows.
Scikit Survival
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Polars
Fast DataFrame library (Apache Arrow). Select, filter, group_by, joins, lazy evaluation, CSV/Parquet I/O, expression API, for high-performance data analysis workflows.
Scikit Survival
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Dask
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.
Anndata
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating 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.
Matplotlib
Low-level plotting library for full customization. Use when you need fine-grained control over every plot element, creating novel plot types, or integrating with specific scientific workflows. Export to PNG/PDF/SVG for publication. For quick statistical plots use seaborn; for interactive plots use plotly; for publication-ready multi-panel figures with journal styling, use scientific-visualization.
Dashboard Design
USE THIS SKILL FIRST when user wants to create and design a dashboard, ESPECIALLY Vizro dashboards. This skill enforces a 3-step workflow (requirements, layout, visualization) that must be followed before implementation. For implementation and testing, use the dashboard-build skill after completing Steps 1-3.
Writing Effective Prompts
Structure Claude prompts for clarity and better results using roles, explicit instructions, context, positive framing, and strategic organization. Use when crafting prompts for complex tasks, long documents, tool workflows, or code generation.
Flowchart Creator
Create HTML flowcharts and process diagrams with decision trees, color-coded stages, arrows, and swimlanes. Use when users request flowcharts, process diagrams, workflow visualizations, or decision trees.
