ensemble-forecast


Nameensemble-forecast JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA lightweight ensemble forecasting library combining classical and ML models.
upload_time2025-10-06 17:18:08
maintainerNone
docs_urlNone
authorAshay Thamankar
requires_python>=3.10
licenseMIT
keywords forecasting ensemble time series machine learning prophet arima sarima croston lstm neural network ets tbats
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Ensemble Forecast

[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
[![PyPI Version](https://img.shields.io/pypi/v/ensemble-forecast.svg)](https://pypi.org/project/ensemble_forecast/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE.txt)

---

Ensemble Forecasting package for combining multiple **time series models** such as ARIMA, SARIMA, Croston, Holt, Holt-Winters, ETS, Prophet, LSTM, and more.  
It provides **automatic model selection** to choose the best-performing models, supports **ensembling** with customizable weights, and allows **forecast optimization** using recent historical data.  
The package also includes **logging of model steps**, **forecast capping** to prevent unrealistic overestimation, and robust handling of **missing or irregular data**, making it suitable for a wide range of time series forecasting tasks.

---

## Features

- Multiple classical and ML time series models in one package
- Automatic best-model selection or ensemble of top models
- Forecast optimization using recent historical data
- Handles missing or irregular data
- Optional parallel processing for faster execution
- Forecast capping to prevent negative or unrealistic values
- Flexible aggregation: daily, monthly, yearly

---

## Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `datetime_col` | str | `'Month_Year'` | Name of the datetime column |
| `datetime_type` | str | `'M'` | Aggregation type: `'D'`=Daily, `'M'`=Monthly, `'Y'`=Yearly |
| `forecast_span` | int | 18 | Number of future periods to forecast |
| `value_col` | str | `'Movement'` | Column containing numeric values to forecast |
| `test_size` | float | 0.2 | Fraction of data reserved for testing |
| `error_metric` | str | `'mape'` | Error metric (`'rmse','mape','smape','mae','mse'`) |
| `top_models` | int | None | Number of top-performing models for ensemble |
| `ensemble_weights` | list | None | Weights for ensemble models (defaults to equal) |
| `optimization` | str | None | Optimization method: `'mean','median','mode',None` |
| `optimization_length` | int | 12 | Number of recent periods used for optimization |
| `optimization_ratio` | str | `'70:30'` | Ratio for blending ensemble forecast with optimization |
| `null_fill_method` | str/int/float | None | Method for missing data (`'ffill','bfill','mean','median','zero','interpolate'` or numeric) |
| `parallel_processing` | bool | False | Train models in parallel |
| `model_list` | list | `['ARIMA','SARIMA','Croston','Holt','HoltWinters',...]` | List of models; supports `'TBATS','BATS','Theta','Prophet','LSTM','NeuralNetwork'` |
| `enable_logging` | bool | False | Enable detailed logging |
| `forecast_capping` | bool | False | Cap forecasts at zero and max historical value |
| `fallback_strategy` | str | `'zero'` | Strategy if a model fails (`'3_mean','6_mean','12_mean','3_median','6_median','12_median','last_value','zero'`) |

---

## Installation

```bash
pip install ensemble-forecast
````

---

## Quick Example (Runnable)

Below is a complete example you can run locally to test the package:

```python
import pandas as pd
import numpy as np
from ensemble_forecast import EnsembleForecast

# Create a sample daily dataset
df = pd.DataFrame({
    "Date": pd.date_range('2023-01-01', periods=36, freq='D'),
    "Movement": np.random.randint(1000, 5000, 36)
})

# Define configuration for EnsembleForecast
config = dict(
    datetime_col='Date',
    datetime_type='D',
    forecast_span=18,
    value_col='Movement',
    test_size=0.2,
    error_metric='RMSE',
    top_models=3,
    ensemble_weights=[0.5, 0.3, 0.1],
    optimization='median',
    optimization_length=6,
    optimization_ratio="75:25",
    parallel_processing=True,
    model_list=['ARIMA', 'SARIMA', 'Croston', 'LSTM', 'ETS','Theta']
)

# Initialize, fit, and predict
model = EnsembleForecast(**config)
model.fit(df)
forecast = model.predict()

# Show the forecast
print(forecast)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ensemble-forecast",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "forecasting, ensemble, time series, machine learning, prophet, ARIMA, SARIMA, Croston, LSTM, neural network, ETS, TBATS",
    "author": "Ashay Thamankar",
    "author_email": "ashaytesting@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e1/bc/4cd659a0fd6396b7c697a0742389abc4eb9fe82c077ba2541d100e8d3cfa/ensemble_forecast-0.1.2.tar.gz",
    "platform": null,
    "description": "# Ensemble Forecast\r\n\r\n[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)\r\n[![PyPI Version](https://img.shields.io/pypi/v/ensemble-forecast.svg)](https://pypi.org/project/ensemble_forecast/)\r\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE.txt)\r\n\r\n---\r\n\r\nEnsemble Forecasting package for combining multiple **time series models** such as ARIMA, SARIMA, Croston, Holt, Holt-Winters, ETS, Prophet, LSTM, and more.  \r\nIt provides **automatic model selection** to choose the best-performing models, supports **ensembling** with customizable weights, and allows **forecast optimization** using recent historical data.  \r\nThe package also includes **logging of model steps**, **forecast capping** to prevent unrealistic overestimation, and robust handling of **missing or irregular data**, making it suitable for a wide range of time series forecasting tasks.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- Multiple classical and ML time series models in one package\r\n- Automatic best-model selection or ensemble of top models\r\n- Forecast optimization using recent historical data\r\n- Handles missing or irregular data\r\n- Optional parallel processing for faster execution\r\n- Forecast capping to prevent negative or unrealistic values\r\n- Flexible aggregation: daily, monthly, yearly\r\n\r\n---\r\n\r\n## Parameters\r\n\r\n| Parameter | Type | Default | Description |\r\n|-----------|------|---------|-------------|\r\n| `datetime_col` | str | `'Month_Year'` | Name of the datetime column |\r\n| `datetime_type` | str | `'M'` | Aggregation type: `'D'`=Daily, `'M'`=Monthly, `'Y'`=Yearly |\r\n| `forecast_span` | int | 18 | Number of future periods to forecast |\r\n| `value_col` | str | `'Movement'` | Column containing numeric values to forecast |\r\n| `test_size` | float | 0.2 | Fraction of data reserved for testing |\r\n| `error_metric` | str | `'mape'` | Error metric (`'rmse','mape','smape','mae','mse'`) |\r\n| `top_models` | int | None | Number of top-performing models for ensemble |\r\n| `ensemble_weights` | list | None | Weights for ensemble models (defaults to equal) |\r\n| `optimization` | str | None | Optimization method: `'mean','median','mode',None` |\r\n| `optimization_length` | int | 12 | Number of recent periods used for optimization |\r\n| `optimization_ratio` | str | `'70:30'` | Ratio for blending ensemble forecast with optimization |\r\n| `null_fill_method` | str/int/float | None | Method for missing data (`'ffill','bfill','mean','median','zero','interpolate'` or numeric) |\r\n| `parallel_processing` | bool | False | Train models in parallel |\r\n| `model_list` | list | `['ARIMA','SARIMA','Croston','Holt','HoltWinters',...]` | List of models; supports `'TBATS','BATS','Theta','Prophet','LSTM','NeuralNetwork'` |\r\n| `enable_logging` | bool | False | Enable detailed logging |\r\n| `forecast_capping` | bool | False | Cap forecasts at zero and max historical value |\r\n| `fallback_strategy` | str | `'zero'` | Strategy if a model fails (`'3_mean','6_mean','12_mean','3_median','6_median','12_median','last_value','zero'`) |\r\n\r\n---\r\n\r\n## Installation\r\n\r\n```bash\r\npip install ensemble-forecast\r\n````\r\n\r\n---\r\n\r\n## Quick Example (Runnable)\r\n\r\nBelow is a complete example you can run locally to test the package:\r\n\r\n```python\r\nimport pandas as pd\r\nimport numpy as np\r\nfrom ensemble_forecast import EnsembleForecast\r\n\r\n# Create a sample daily dataset\r\ndf = pd.DataFrame({\r\n    \"Date\": pd.date_range('2023-01-01', periods=36, freq='D'),\r\n    \"Movement\": np.random.randint(1000, 5000, 36)\r\n})\r\n\r\n# Define configuration for EnsembleForecast\r\nconfig = dict(\r\n    datetime_col='Date',\r\n    datetime_type='D',\r\n    forecast_span=18,\r\n    value_col='Movement',\r\n    test_size=0.2,\r\n    error_metric='RMSE',\r\n    top_models=3,\r\n    ensemble_weights=[0.5, 0.3, 0.1],\r\n    optimization='median',\r\n    optimization_length=6,\r\n    optimization_ratio=\"75:25\",\r\n    parallel_processing=True,\r\n    model_list=['ARIMA', 'SARIMA', 'Croston', 'LSTM', 'ETS','Theta']\r\n)\r\n\r\n# Initialize, fit, and predict\r\nmodel = EnsembleForecast(**config)\r\nmodel.fit(df)\r\nforecast = model.predict()\r\n\r\n# Show the forecast\r\nprint(forecast)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A lightweight ensemble forecasting library combining classical and ML models.",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "forecasting",
        " ensemble",
        " time series",
        " machine learning",
        " prophet",
        " arima",
        " sarima",
        " croston",
        " lstm",
        " neural network",
        " ets",
        " tbats"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8208f24ff86e7e0f2b367cdce9dba1ad24ecdb72063cfaa0ca50672a58cae6a7",
                "md5": "0cf836220ebae919b964dd0944fb0125",
                "sha256": "fa3603d033d3f9d1cad3974b1acd995a0c7732c66819619180ca0cbf1a834fbe"
            },
            "downloads": -1,
            "filename": "ensemble_forecast-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0cf836220ebae919b964dd0944fb0125",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 20914,
            "upload_time": "2025-10-06T17:18:06",
            "upload_time_iso_8601": "2025-10-06T17:18:06.693554Z",
            "url": "https://files.pythonhosted.org/packages/82/08/f24ff86e7e0f2b367cdce9dba1ad24ecdb72063cfaa0ca50672a58cae6a7/ensemble_forecast-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e1bc4cd659a0fd6396b7c697a0742389abc4eb9fe82c077ba2541d100e8d3cfa",
                "md5": "d108bd49d321caadcefd9187d3682f37",
                "sha256": "4b95d351645e69c14bda3a779908d7aacd2255d65245e1a7158120143c7bc311"
            },
            "downloads": -1,
            "filename": "ensemble_forecast-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d108bd49d321caadcefd9187d3682f37",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 22515,
            "upload_time": "2025-10-06T17:18:08",
            "upload_time_iso_8601": "2025-10-06T17:18:08.366154Z",
            "url": "https://files.pythonhosted.org/packages/e1/bc/4cd659a0fd6396b7c697a0742389abc4eb9fe82c077ba2541d100e8d3cfa/ensemble_forecast-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 17:18:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ensemble-forecast"
}
        
Elapsed time: 1.64792s