Skip to content

[AINode] Add Prophet and StatsForecaster to Built-in Forecast Models #16958

@YousefMohassab

Description

@YousefMohassab

Feature Request

Add Prophet (Facebook/Meta) and StatsForecaster to the built-in forecast models in IoTDB AINode, alongside existing models like ARIMA, HoltWinters, and Timer-XL.

Motivation

  1. Prophet is a widely-used forecasting library that handles seasonality, holidays, and missing data automatically. It's production-proven at scale.

  2. StatsForecaster provides efficient statistical models (AutoARIMA, AutoETS, AutoTheta) that are significantly faster than traditional implementations while maintaining accuracy.

  3. Both libraries are already common dependencies in time-series forecasting pipelines, making IoTDB a more complete solution for industrial IoT analytics.

Proposed Changes

1. ConfigNode (Java)

Add models to the whitelist in ModelInfo.java:

// iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/ModelInfo.java
static {
    builtInForecastModel.add("arima");
    builtInForecastModel.add("naive_forecaster");
    // ... existing models ...
    builtInForecastModel.add("prophet");      // NEW
    builtInForecastModel.add("statsforecast"); // NEW
}

2. AINode (Python)

constant.py - Add Prophet attributes:

class AttributeName(Enum):
    # Prophet attributes
    YEARLY_SEASONALITY = "yearly_seasonality"
    WEEKLY_SEASONALITY = "weekly_seasonality"
    DAILY_SEASONALITY = "daily_seasonality"
    SEASONALITY_MODE = "seasonality_mode"

model_info.py - Add model enum and mapping:

class BuiltInModelType(Enum):
    PROPHET = "Prophet"
    STATSFORECASTER = "StatsForecaster"

BUILT_IN_MACHINE_LEARNING_MODEL_MAP = {
    "prophet": ModelInfo(model_id="prophet", ...),
    "statsforecast": ModelInfo(model_id="statsforecast", ...),
}

built_in_model_factory.py - Add model implementations.

3. Dependencies

Add to AINode requirements:

prophet>=1.1.5
statsforecast>=1.7.0

Usage Example

-- Prophet forecast
SELECT prophet(temperature, 'predict_length'='24', 'daily_seasonality'='true')
FROM root.factory.sensor1
WHERE time >= 2024-01-01 AND time < 2024-02-01

-- StatsForecaster with AutoARIMA
SELECT statsforecast(temperature, 'predict_length'='24', 'model'='autoarima')
FROM root.factory.sensor1
WHERE time >= 2024-01-01 AND time < 2024-02-01

Benefits

  • Performance: Built-in models execute 7-20x faster than API-based approaches due to eliminated Python client overhead
  • Simplicity: Native SQL interface without requiring external Python code
  • Production-ready: Both libraries are battle-tested in production environments

Additional Context

I have working prototype patches for the AINode side. Happy to contribute a PR if there's interest.

/cc @apache/iotdb-committers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions