YousefMohassab opened a new issue, #16958:
URL: https://github.com/apache/iotdb/issues/16958

   ## 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`:
   
   ```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:
   ```python
   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:
   ```python
   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
   
   ```sql
   -- 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to