mirror of
https://github.com/K-Dense-AI/claude-scientific-skills.git
synced 2026-03-27 07:09:27 +08:00
feat(example): add working TimesFM forecast example with global temperature data
- Add NOAA GISTEMP global temperature anomaly dataset (36 months, 2022-2024) - Run TimesFM 1.0 PyTorch forecast for 2025 (12-month horizon) - Generate fan chart visualization with 80%/90% confidence intervals - Create comprehensive markdown report with findings and API notes API Discovery: - TimesFM 2.5 PyTorch checkpoint has file format issue (model.safetensors vs expected torch_model.ckpt) - Working API uses TimesFmHparams + TimesFmCheckpoint + TimesFm() constructor - Documented API in GitHub README differs from actual pip package Includes: - temperature_anomaly.csv (input data) - forecast_output.csv (point forecast + quantiles) - forecast_output.json (machine-readable output) - forecast_visualization.png (LFS-tracked) - run_forecast.py (reusable script) - visualize_forecast.py (chart generation) - run_example.sh (one-click runner) - README.md (full report with findings)
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# run_example.sh - Run the TimesFM temperature anomaly forecasting example
|
||||
#
|
||||
# This script:
|
||||
# 1. Runs the preflight system check
|
||||
# 2. Runs the TimesFM forecast
|
||||
# 3. Generates the visualization
|
||||
#
|
||||
# Usage:
|
||||
# ./run_example.sh
|
||||
#
|
||||
# Prerequisites:
|
||||
# - Python 3.10+
|
||||
# - timesfm[torch] installed: uv pip install "timesfm[torch]"
|
||||
# - matplotlib, pandas, numpy
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
|
||||
echo "============================================================"
|
||||
echo " TimesFM Example: Global Temperature Anomaly Forecast"
|
||||
echo "============================================================"
|
||||
|
||||
# Step 1: Preflight check
|
||||
echo ""
|
||||
echo "🔍 Step 1: Running preflight system check..."
|
||||
python3 "$SKILL_ROOT/scripts/check_system.py" || {
|
||||
echo "❌ Preflight check failed. Please fix the issues above before continuing."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Step 2: Run forecast
|
||||
echo ""
|
||||
echo "📊 Step 2: Running TimesFM forecast..."
|
||||
cd "$SCRIPT_DIR"
|
||||
python3 run_forecast.py
|
||||
|
||||
# Step 3: Generate visualization
|
||||
echo ""
|
||||
echo "📈 Step 3: Generating visualization..."
|
||||
python3 visualize_forecast.py
|
||||
|
||||
echo ""
|
||||
echo "============================================================"
|
||||
echo " ✅ Example complete!"
|
||||
echo "============================================================"
|
||||
echo ""
|
||||
echo "Output files:"
|
||||
echo " - $SCRIPT_DIR/forecast_output.csv"
|
||||
echo " - $SCRIPT_DIR/forecast_output.json"
|
||||
echo " - $SCRIPT_DIR/forecast_visualization.png"
|
||||
Reference in New Issue
Block a user