Skip to main content

AnoFox Forecast Extension

Enterprise Time-Series Forecasting in SQL

Generate forecasts directly in DuckDB with 31 state-of-the-art modelsβ€”no Python, no complex pipelines. Just SQL.

30-Second Example​

-- Load the extension
LOAD anofox_forecast;

-- Forecast your first series
SELECT
forecast_step,
date_col,
point_forecast,
lower_95,
upper_95
FROM TS_FORECAST(
'sales_data', -- Your table
'date', -- Date column
'amount', -- Value column
'AutoETS', -- Model
28, -- Forecast horizon (days)
{'confidence_level': 0.95}
);

Output: 28 future forecasts with prediction intervals.


What's Included​

ComponentCoverageHighlights
Forecasting Models31 algorithmsAutoML, Statistical, Advanced, Intermittent demand
Data Preparation12 macrosQuality checks, gap filling, transformations
DiagnosticsDetection + AnalysisSeasonality, changepoints, outliers
Evaluation12 metricsMAE, RMSE, MAPE, SMAPE, MASE, and more
Feature Engineering76+ featurestsfresh-compatible statistical features

Quick Navigation​

πŸ‘¨β€πŸŽ“ New to Forecasting?​

Start with Understanding Forecasting to learn core concepts, then try the 5-Minute Quickstart.

πŸ”§ Getting Started​

πŸ“š Learn by Doing​

Practical guides for common tasks:

🎯 Understand the Concepts​

Deep dives into forecasting fundamentals:

πŸ“– Complete API Reference​

Detailed documentation for every function:


Why AnoFox Forecast?​

⚑ Native Performance​

  • Zero Python overhead: Direct C++ execution in DuckDB
  • Automatic parallelization: DuckDB distributes work across CPU cores
  • In-database: Process petabyte-scale data without moving it
  • WASM-compatible: Run forecasts in the browser

🧠 Comprehensive Algorithms​

  • AutoML models for automatic parameter tuning (AutoARIMA, AutoETS, etc.)
  • Statistical models proven in production (ARIMA, Exponential Smoothing, Theta)
  • Advanced techniques for complex patterns (TBATS, MSTL, MFLES)
  • Intermittent demand models for sparse data (Croston, ADIDA, IMAPA)

πŸ“Š Production-Ready​

  • Complete workflows: From raw data to deployment
  • Diagnostic tools: Detect seasonality, changepoints, outliers
  • Evaluation metrics: 12 ways to assess forecast quality
  • Scalable: Handles millions of time series

🀝 Easy Integration​

  • Pure SQL API: No new languages or DSLs
  • DuckDB native: Works with any DuckDB client
  • Multi-language: Access from Python, R, Julia, JavaScript, C++, Rust
  • Composable: Chain functions for complex workflows

Feature Comparison​

                    | AnoFox | Python (statsforecast) | R (forecast)
--------------------|--------|------------------------|------------------
Installation | Native | Requires Python env | Requires R env
Parallelization | Auto | Manual partitioning | Manual parallelization
Data movement | Zero | Copy to Python/Pandas | Copy to R
Speed (100K series) | Fast | Medium (Python + serial) | Medium (serial)
Models | 31 | 20+ | 15+
Intermittent demand | Yes | Limited | Limited
In-database storage | Yes | No | No

Installation & Quick Start​

Install the Extension​

-- From the DuckDB community extension registry (recommended)
INSTALL anofox_forecast FROM community;
LOAD anofox_forecast;

-- Or build from source for the latest features
-- See Installation guide for details

Verify Installation​

-- Check that the extension loaded
SELECT * FROM TS_FORECAST(
'SELECT DATE \'2023-01-01\' + INTERVAL (d) DAY AS date,
100 + RANDOM() * 10 AS value
FROM generate_series(0, 99) t(d)',
'date',
'value',
'Naive',
7,
{}
) LIMIT 5;

Next steps:


Function Finder​

Use this table to find the right function for your task:

What I Want To DoRecommended FunctionGuide
Generate a forecastTS_FORECAST or TS_FORECAST_BYBasic Workflow
Forecast multiple seriesTS_FORECAST_BYBasic Workflow
Check forecast accuracyTS_MAE, TS_RMSE, TS_MAPEEvaluation Metrics
Detect seasonalityTS_DETECT_SEASONALITYSeasonality Detection
Find structural breaksTS_DETECT_CHANGEPOINTSPattern Detection
Clean dataTS_FILL_GAPS, TS_REMOVE_OUTLIERSData Preparation
Extract featuresTS_TSFRESH_FEATURESFeature Engineering
Forecast sparse dataTS_CROSTON, TS_ADIDAIntermittent Demand
Try many modelsTS_FORECAST_ENSEMBLEModel Comparison
Get data quality reportTS_QUALITY_REPORTData Preparation

Key Concepts at a Glance​

Time Series​

A sequence of values measured over time. Examples: daily sales, hourly temperature, monthly revenue.

Forecast Horizon​

How many time steps ahead to predict. "Forecast 30 days ahead" = horizon of 30.

Seasonality​

Repeating patterns in data. E.g., retail sales spike before Christmas, electricity demand peaks in summer.

Trend​

Long-term direction. E.g., "sales have been increasing for the last year."

Prediction Interval​

Range of uncertainty around a forecast. E.g., "95% confident the value will be between 100 and 120."


Performance Characteristics​

Tested on standard hardware (Dell XPS 13, 8-core CPU):

TaskData SizeTimeNotes
Single series ARIMA2 years daily<1sMonthly M5 dataset
10,000 series Theta30k points total<5sParallel on 8 cores
100,000 series Naive100k points total<1sBaseline model
Feature extraction1M points~30s76 statistical features

See Production Deployment for optimization strategies.


What's New​

  • 31 forecasting models: Full model coverage across all categories
  • Automatic model selection: AutoML for ARIMA, ETS, MFLES, TBATS, Theta
  • Multiple seasonality: MSTL for complex seasonal patterns
  • Feature engineering: 76+ tsfresh-compatible features
  • Changepoint detection: Bayesian Online Changepoint Detection (BOCPD)
  • Production-ready: Monitoring, logging, deployment guides

Support & Community​


License​

Licensed under the Business Source License 1.1 (BSL-1.1). See LICENSE for details.

Key points:

  • Free for development, testing, and academic research
  • Converts to Apache License 2.0 on January 1, 2027
  • See full license terms for commercial use

Next Steps​

  1. First time here? β†’ Installation Guide
  2. Want to forecast? β†’ 5-Minute Quickstart
  3. New to time-series? β†’ Understanding Forecasting
  4. Building an application? β†’ Production Deployment
  5. Need a specific function? β†’ API Reference
πŸͺ Cookie Settings