Skip to main content

MFLES v0.2.2

alt text

A Specific implementation from ThymeBoost written with the help of Numba.

Here is a quick Introduction and demonstration of methods such as Conformal Prediction Intervals and seasonality decomposition:

https://github.com/tblume1992/MFLES/blob/main/examples/MFLES_Intro.ipynb

Here is a quick benchmark vs AutoETS from M4: alt text

Quick Start:

Install via pip

pip install MFLES

Import MFLES class

from MFLES.Forecaster import MFLES

Import data

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.read_csv(r'https://raw.githubusercontent.com/jbrownlee/Datasets/master/airline-passengers.csv')

Fit and predict!

mfles = MFLES()
fitted = mfles.fit(df['Passengers'].values, seasonal_period=12)
predicted = mfles.predict(12)

plt.plot(np.append(fitted, predicted))
plt.plot(df['Passengers'].values)
plt.show()

alt text

Or Optimize

mfles = MFLES()
opt_params = mfles.optimize(df['Passengers'].values,
                          seasonal_period=12,
                          test_size=6,
                          n_steps=3, #number of train/test splits to make
                          step_size=6, #the number of periods to move each step
                          metric='mse' #should support smape, mse, mae, mape
                          )
fitted = mfles.fit(df['Passengers'].values, **opt_params)
predicted = mfles.predict(12)

plt.plot(np.append(fitted, predicted))
plt.plot(df['Passengers'].values)
plt.show()

Fitting from dataframe:

from MFLES.Forecaster import fit_from_df

output = fit_from_df(df,
                      forecast_horizon=24,
                      freq='M',
                      seasonal_period=12,
                      id_column='unique_id',
                      time_column='ds',
                      value_column='y',
                      floor=0)

Optimizing from dataframe

from MFLES.Forecaster import optimize_from_df

output = optimize_from_df(df,
                          forecast_horizon=4,
                          test_size=4,
                          n_steps=3,
                          step_size=1,
                          metric='mse',
                          seasonal_period=12,
                          freq='M')

Gradient Boosted Time Series Decomposition Theory

The idea is pretty simple, take a process like decomposition and view it as a type of 'psuedo' gradient boosting since we are passing residuals around simlar to standard gradient boosting. Then apply gradient boosting approaches such as iterating with a global mechanism to control the process and introduce learning rates for each of the components in the process such as trend or seasonality or exogenous. By doing this we graduate from this 'psuedo' approach to full blown gradient boosting.

This process allows us to fit pretty exotic models and optimize for each learning rate to make them jive. Also enables online learning since the framework is made for residuals. Also opens up changepoint detection using segmentation schemes although that is out-of-scope of this library.

Citing

@software{
author = {Blume Tyler},
license = {MIT License},
title = {{MFLES}},
url = {https://github.com/tblume1992/MFLES},
version = {0.2.2},
year = {2024}
}

Metadata

Release files for MFLES 0.2.4

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

Built distribution (wheel)

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

Release files / MFLES-0.2.4-py3-none-any.whl

Download URL MFLES-0.2.4-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
202dda077398a281c24130c9ff2a599b1dfebe4a90cb0d59f073a4e22a62adf1
BLAKE2b-256 checksum
How to use checksums
5cc23457053a4379968579e4fb89255d4e3079e2b784e712fcdf8c2e6373b3f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.15

Release history Release notifications | RSS feed

This release

0.2.4 This release

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

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