Time Series Forecasting and Nixtla Ecosystem!
Python Milano meetup
Milan, May 18th 2023
past: Math (Pisa, Trieste), Climate Science (Paris), Cryptography (Trento)
now (since 2015): Principal Data Scientist at ToolsGroup: Supply Chain Planning Software
Python: started early 2000s, serious around 2015, my first presentation in... May 2023 ;)
...also active in Open Source with Nim
t | y |
---|---|
0 | 5 |
1 | 35 |
2 | 15 |
3 | 23 |
4 | 25 |
5 | 30 |
6 | ? |
Given:
$$y_t$$ $$t=0, 1, \ldots, T$$
Provide:
$\hat{y}_{T + 1}$
(+ confidence)
events planning (how many?)
weather forecasting (sun or rain?)
economics (growth next year?)
control theory (reactor will heat?)
finance (stock up or down?)
web analytics (how much traffic?)
energy (how much consumption?)
supply chain (how many sales?)
equations with $t$ (ODEs, PDEs, ...)
judgmental forecasts
statistical forecasting
classical (ETS, ARIMA, ...)
ml (random forest, LGBM, ...)
neural (NBEATS, DeepAR, ...)
ensemble forecasting
$$ \text{MAPE} = \frac{1}{N} \Sigma \frac{\left| e_t \right|}{d_t} $$
$$ \text{MAE} = \frac{1}{N} \Sigma \left| e_t \right| $$
$$ \text{RMSE} = \sqrt{\frac{1}{N} \Sigma e_t^2} $$
AutoETS performs automatic model selection
by Rob J Hyndman and George Athanasopoulos
Monash University, Australia
3rd edition, May 2021
free! otexts.com/fpp3/
R-based
The best Python implementations for my time series methods are available from Nixtla.
Hi! At nixtla, we have just launched our MVP: Open Source Forecasting Pipeline. We want to democratize access to state-of-the-art forecasting models. Feedback and comments are welcome! https://t.co/1y7ttPYNgy
— fede garza (they/them) (@fede_gr) October 15, 2021
I'm thrilled to announce that we're releasing the fastest #autoarima implementation for #Python today! 😍
— fede garza (they/them) (@fede_gr) February 22, 2022
It is a mirror implementation of @robjhyndman's #autoarima (R) and it is optimized using @numba_jit. It is 20x faster than pmdarima and @MetaAI's Prophet. 😎
🧵@nixtlainc
Forecast 1M time series in 30 minutes. @nixtlainc + @raydistributed + @numba_jit = 🤩 🚀 ⚡
— fede garza (they/them) (@fede_gr) May 3, 2022
Recently, we launched the fastest version of #AutoARIMA for #python. Now you can scale your computation horizontally for millions of time series, leveraging the power of @raydistributed pic.twitter.com/zkfBL0FYJ4
🎉Today at @nixtlainc, we are excited to release our new 👑HierarchicalForecast library. 🔥
— fede garza (they/them) (@fede_gr) July 26, 2022
You can simply reconcile forecasts for hierarchical problems using statistical approaches such as Bottom Up, Top Down, Middle Out, Minimum Trace, and ERM. #Python #Forecasting
🎉 We are thrilled to announce the release of the latest version of mlforecast a #Python library for Scalable #machinelearning 🤖 for #timeseries #forecasting
— nixtla (@nixtlainc) February 21, 2023
🚀 This version comes with exciting new features that are sure to make forecasting even more efficient and accurate
🧵 pic.twitter.com/UR7wM0DTUJ
Risks: moving fast, iterating on business model
import lightgbm as lgbm
from mlforecast import MLForecast
from window_ops.expanding import expanding_mean
from window_ops.rolling import rolling_mean
mlf = MLForecast(
models = [lgbm.LGBMRegressor()], # list of models
freq = 'MS', # frequency of time series: month start
differences=[12], # differences to apply to target
lags=[1, 12], # lags to use as feature
lag_transforms=( # lag transformation to apply to specific lags
1: [expanding_mean],
12: [(rolling_mean, 24)],
)
)
A declarative feature engineering pipeline!
mlf.fit(df)
forecast_df = mlf.predict(12, levels=[90])