Skip to main content

forecast

License

Overview

forecast 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 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

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.model_select import ForecastModelSelect
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
LFMS.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-ar 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forecast-ar 0.0.1
File Size Uploaded
forecast_ar-0.0.1.tar.gz 20.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for forecast-ar 0.0.1
File Interpreter ABI Platform
forecast_ar-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.7 kB

Release files / forecast_ar-0.0.1.tar.gz

Download URL forecast_ar-0.0.1.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
23411688a14ca47f9d448e48a00166a813a05da86fe67657333cecf0057e0304
BLAKE2b-256 checksum
How to use checksums
3ea13a8d4512a467e9f0c4db605e9071accc73110106b0e06ba21de2747cb740
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.7 Linux/5.15.0-1039-aws

Release files / forecast_ar-0.0.1-py3-none-any.whl

Download URL forecast_ar-0.0.1-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
571428e456bf5d31f856797ea6f443539ab37a25186a82ca3845f0e9040be30d
BLAKE2b-256 checksum
How to use checksums
333c1d70fd88c4fc0751f078dafba80f1a74a989c408d0c766c07118af421cf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.7 Linux/5.15.0-1039-aws

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page