Skip to main content

Automation of forecast models testing, combining and predicting

Project description

forecast_combine

License

Overview

forecast_combine is a Python library built upon the foundation of the sktime library, designed to simplify and streamline the process of forecasting and prediction model aggregation. It provides tools for aggregating predictions from multiple models, evaluating their performance, and visualizing the results. Whether you're working on time series forecasting, data analysis, or any other predictive modeling task, forecast_combine offers a convenient and efficient way to handle aggregation and comparison.

Key Features

  • Model Aggregation: Easily aggregate predictions from multiple models using various aggregation modes such as best model overall, best model per horizon, inverse score weighted average model, and more.
  • Out-of-Sample Evaluation: Evaluate model performance using out-of-sample data and choose the best models based on user-defined performance metrics.
  • Visualization: Visualize model performance, aggregated predictions, and prediction intervals with built-in plotting functions.
  • Flexibility: Accommodate various aggregation strategies, forecast horizons, and performance metrics to cater to your specific use case.

Installation

Install Your Package Name using pip:

pip install forecast_combine

Usage

# Import the necessary classes from your-package-name
data = pd.Series(np.cumsum(np.random.normal(0, 1, size=1000)), 
                 index=pd.date_range(end='31/12/2022', periods=1000)).rename('y').to_frame()

from forecast_combine.model_select import ForecastModelSelect
# models necessary to define the forecasting models 
from sktime.forecasting.naive import NaiveForecaster
from sktime.forecasting.statsforecast import (
    StatsForecastAutoARIMA,
    StatsForecastAutoETS, 
    StatsForecastAutoTheta
)
from sktime.forecasting.tbats import TBATS
from sktime.forecasting.fbprophet import Prophet

ForecastingModels = {
"Naive": NaiveForecaster(),
"AutoARIMA": StatsForecastAutoARIMA(),
"AutoETS": StatsForecastAutoETS(),
"AutoTheta": StatsForecastAutoTheta(),
"TBATS": TBATS(),
"Prophet": Prophet(),
}
model = ForecastModelSelect(
            data= data,
            depvar_str = 'y',                 
            exog_l=None,
            fh = 10,
            pct_initial_window=0.75,
            step_length = 25,
            models_d = ForecastingModels,
            freq = 'B',
            mode = 'nbest_average_horizon',
            score = 'RMSE', 
            nbest = 2)

# compare models
model.select_best(score = 'MAPE')
# Visualize model comparison
model.plot_model_compare(score='MAPE', view='horizon')
model.plot_model_compare(score='MAPE', view='cutoff')

# Generate prediction
y_pred, y_pred_ints, preds, pred_ints =  model.predict(score='RMSE', ret_underlying=True)

# Visualize prediction
model.plot_prediction(y_pred = y_pred,
                     models_preds = preds,
                     y_pred_interval = y_pred_ints, 
                     title = 'Prediction')

Documentation

For detailed information about available classes, methods, and parameters, please refer to the Documentation.

License

This project is licensed under the MIT License.

Contributing

We welcome contributions from the community! If you have suggestions, bug reports, or feature requests, please open an issue or submit a pull request.

Contact

For queries, support, or general inquiries, please feel free to reach me at amineraboun@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forecast_combine-0.0.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forecast_combine-0.0.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file forecast_combine-0.0.1.tar.gz.

File metadata

  • Download URL: forecast_combine-0.0.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.7 Linux/5.15.0-1039-aws

File hashes

Hashes for forecast_combine-0.0.1.tar.gz
Algorithm Hash digest
SHA256 86b72325b834330d33d3668d8c341e7af6b70f7ad48a0dbac6851271a9901c3c
MD5 78016fe5de37f329004912225553ed03
BLAKE2b-256 be020629ab3095a57f7fdc05e951fee7fe8e9d8e4ffeaf9de2ba64b402598e8e

See more details on using hashes here.

File details

Details for the file forecast_combine-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: forecast_combine-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.7 Linux/5.15.0-1039-aws

File hashes

Hashes for forecast_combine-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6a261c20c4befb7d970db1393fce7b953e9d6f5351b750133db6fb86586698
MD5 ecc9a18e6dc077660b359b7565a83d4a
BLAKE2b-256 1b4beae20a1172a7c9d36970d17f0148004dc84ca3a540d6299da3d875791a08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page