Skip to main content

forecastout

ForecastOut makes predictions for univariate time series using both statistical and machine learning approaches.

The algorithm works for both monthly and daily data.

In the case of monthly data, ForecastOut makes predictions using different statistical models (ARIMA, variations of Holt-Winters, Prophet, etc.) and then ensembles them using backtesting. A Naive Seasonal model is averaged into the resulting prediction in case the latter is not plausible.

For daily data, ForecastOut first aggregates the data (by summing or averaging) on a monthly basis and applies the algorithm described above to make a monthly forecast. Then, it disaggregates the monthly forecast to a daily basis using the time series and calendar information in a Random Forest.

The algorithm provides not only the forecast output and 95% confidence bands but also detailed results of each model, backtesting, and time series decomposition.

Installation

pip install forecastout

Quickstart

To make a prediction, you only need one necessary input: a pandas DataFrame with two columns:

  • date: string format "YYYY-MM-DD" (e.g., "2024-01-01").
  • value: integer or float format (e.g., 1000.0).

It should contain at least 24 monthly observations (if the data is daily, it should cover more than 24 months).

import pandas as pd
from forecastout import ForecastOut

forecastout = ForecastOut(
    df=pd.DataFrame()
)

This will directly execute a prediction for 15 months for the inserted time series input. You can access the results as follows:

# -- Monthly forecast output
print(forecastout.df_monthly_forecast)
# -- Monthly forecast predictions by model
print(forecastout.df_predictions_by_model) 
# -- Daily forecast output (if daily data)
print(forecastout.df_daily_forecast)
 # -- Time series decomposition
print(forecastout.df_ts_decomposition)
 # -- Backtesting predictions for each model
print(forecastout.df_predictions_bt)
 # -- Daily decomposition percentage (if daily data)
print(forecastout.df_daily_shares)

Inputs

ForecastOut can customize the results through the following parameters.

import pandas as pd
from forecastout import ForecastOut

    forecastout = ForecastOut(
        df=pd.DataFrame(),
        sum_aggregation=True,
        horizon=3,
        months_to_backtest=3,
        models_to_use=['autoarima', 'holtwinters', 'prophet'],
        average_top_models_number=1
    )
  • sum_aggregation (bool): If True, it adds daily data. If False, it averages daily data.
  • horizon (int): Number of periods to forecast.
  • months_to_backtest (int): Number of periods to do the backtesting.
  • models_to_use (list): List of models to be used. ForecastOut has available 'autoarima', 'holtwinters' and 'prophet' (new coming soon).
  • average_top_models_number (int): Number of models to use as average (if 1, it selects the most precise model in the backtesting).

Remarks

  • Calendar Data available is only for Spain when doing the disaggregation from monthly to daily data (more calendars will be available in the future).
  • In case the input DataFrame contains gaps, they will be assumed to be 0 value.

Metadata

Release files for forecastout 0.0.5

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

Source distribution (sdist)

Source distribution for forecastout 0.0.5
File Size Uploaded Provenance
forecastout-0.0.5.tar.gz 17.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for forecastout 0.0.5
File Interpreter ABI Platform
forecastout-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 48.2 kB

Release files / forecastout-0.0.5.tar.gz

Download URL forecastout-0.0.5.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f20c9e8c6ed24fb802a436543b485bf08bf63d750cce5fb90f6e2c69eb929922
BLAKE2b-256 checksum
How to use checksums
5f1d0507dee7e4cd918f49b6d16a0daf30d84457d0cd96513590afbcd4da0d16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.8.18 Linux/6.5.0-1021-azure

Release files / forecastout-0.0.5-py3-none-any.whl

Download URL forecastout-0.0.5-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa70cc542594b762d4d72490faafdd475ff03da2a2b642d2fb006e02823417e6
BLAKE2b-256 checksum
How to use checksums
72a967114243d799c1ab16ea2d24f7f0d05fc256d167af113065b6c201771d15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.8.18 Linux/6.5.0-1021-azure

Security for forecastout 0.0.5

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.

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