forecast_combine
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
# Read the data
import pandas as pd
import numpy as np
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()
# Import the package
from forecast_combine.model_select import ForecastModelSelect
# Import the packages of the models to test
from sktime.forecasting.naive import NaiveForecaster
from sktime.forecasting.statsforecast import (
StatsForecastAutoARIMA,
StatsForecastAutoETS,
StatsForecastAutoTheta,
StatsForecastAutoTBATS
)
# Define the forecasting models
ForecastingModels = {
"Naive": NaiveForecaster(),
"AutoARIMA": StatsForecastAutoARIMA(),
"AutoETS": StatsForecastAutoETS(),
"AutoTheta": StatsForecastAutoTheta(),
"AutoTBATS": StatsForecastAutoTBATS(seasonal_periods=1),
}
model = ForecastModelSelect(
data= data,
depvar_str = 'y',
exog_l=None,
fh = 10,
pct_initial_window=0.75,
step_length = 5,
forecasters_d = ForecastingModels,
freq = 'B',
mode = 'best_horizon',
score = 'RMSE', )
# evaluate all the models out-of-sample
summary_horizon, summary_results = model.evaluate()
# compare models
rank, score = model.select_best(score = 'MAPE')
# Visualize model comparison
model.plot_model_compare(score ='MAPE', view = 'cutoff')
model.plot_model_compare(score ='MAPE', view = 'horizon')
# 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.
Metadata
Release files for forecast_combine 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| forecast_combine-0.0.6.tar.gz | 31.9 kB | Without provenance | Details for forecast_combine-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| forecast_combine-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for forecast_combine-0.0.6-py3-none-any.whl |
Total release size: 65.4 kB
Release files / forecast_combine-0.0.6.tar.gz
| Download URL | forecast_combine-0.0.6.tar.gz |
|---|---|
| Size | 31.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84d1b064c3553a9fe7f04d50d4f87c2626fcfb90a4b1205d0c8f957cd76607db
|
|
BLAKE2b-256 checksum How to use checksums |
a71818fa59f6b33b9147a3ba67814b694b95a4bd2f1d71c57ecb707b013d9a67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.7 Linux/5.15.0-1067-aws
|
Release files / forecast_combine-0.0.6-py3-none-any.whl
| Download URL | forecast_combine-0.0.6-py3-none-any.whl |
|---|---|
| Size | 33.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b16ee8d2569c063ddbe4cc62555b7a798dfe5a6b51f6cc9da2510df35b4f16c8
|
|
BLAKE2b-256 checksum How to use checksums |
95d56d00f49fdd1ba7548680332f20e12f5fca695d8c89369cc6a12624809c26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.7 Linux/5.15.0-1067-aws
|
Security for forecast_combine 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.