Phi Nguyen
09/08/2022, 4:39 PMPhi Nguyen
09/08/2022, 4:42 PMPhi Nguyen
09/08/2022, 4:43 PMfrom time import time
import ray
import pandas as pd
#from neuralforecast.data.datasets.m5 import M5, M5Evaluation
from statsforecast import StatsForecast
from statsforecast.models import ETS
ray.init(address="auto")
Y_df = pd.read_parquet('<s3://m5-benchmarks/data/train/target.parquet>')
Y_df = Y_df.rename(columns={
'item_id': 'unique_id',
'timestamp': 'ds',
'demand': 'y'
})
Y_df['ds'] = pd.to_datetime(Y_df['ds'])
Y_df = Y_df[Y_df.unique_id == "FOODS_1_001_CA_1"]
constant = 10
Y_df['y'] += constant
fcst = StatsForecast(
df=Y_df,
models=[ETS(season_length=7, model='ZNA')],
freq='D'
)
Y_hat = fcst.forecast(28)
Max (Nixtla)
09/08/2022, 4:53 PMY_df = Y_df[Y_df.unique_id == "FOODS_1_001_CA_1"]
# The problem was that the type was a category.
# Add this line
Y_df['unique_id'] = Y_df['unique_id'].astype(str)
Max (Nixtla)
09/08/2022, 4:54 PMfrom time import time
import ray
import pandas as pd
#from neuralforecast.data.datasets.m5 import M5, M5Evaluation
from statsforecast import StatsForecast
from statsforecast.models import ETS
ray.init(address="auto")
Y_df = pd.read_parquet('<s3://m5-benchmarks/data/train/target.parquet>')
Y_df = Y_df.rename(columns={
'item_id': 'unique_id',
'timestamp': 'ds',
'demand': 'y'
})
Y_df['ds'] = pd.to_datetime(Y_df['ds'])
Y_df = Y_df[Y_df.unique_id == "FOODS_1_001_CA_1"]
# Add this line
Y_df['unique_id'] = Y_df['unique_id'].astype(str)
constant = 10
Y_df['y'] += constant
fcst = StatsForecast(
df=Y_df,
models=[ETS(season_length=7, model='ZNA')],
freq='D'
)
Y_hat = fcst.forecast(28)
Phi Nguyen
09/08/2022, 5:35 PMTia Guo
09/12/2022, 4:09 PMJonathan Farland
09/13/2022, 9:47 PMHierarchicalForecast
for a few applications - are there are utility or helper functions to generate the S
matrix for a given hierarchy? thanks in advanceGinger Holt
09/14/2022, 4:50 PMEmre Varol
09/19/2022, 8:32 AMmlforecast
. They are quite speedy. On the other hand, after upgrading the xgboost
on Colab
, I realized that the forecasts have changed dramatically.
Could you please check the pic and the notebook below? Any suggestions will be welcomed.
@Max (Nixtla) @fede (nixtla) (they/them)Ginger Holt
09/26/2022, 11:55 PMfcst = StatsForecast(df=Y_df_train,
models=[ETS(season_length=4, model='ZZA')],
freq='QS', n_jobs=-1)
Y_hat_df = fcst.forecast(h=8, fitted=True)
Y_fitted_df = fcst.forecast_fitted_values()
https://github.com/Nixtla/hierarchicalforecast/blob/main/nbs/examples/AustralianDomesticTourism.ipynbGinger Holt
09/28/2022, 10:29 PMKin Gtz. Olivares
09/28/2022, 10:42 PMGinger Holt
09/29/2022, 5:17 PMMax (Nixtla)
09/29/2022, 5:19 PMValeriy
10/06/2022, 3:43 PMJ T
10/06/2022, 9:14 PMJ T
10/06/2022, 9:15 PMRan under AZ databrick.
here is the code:
#Select SARIMA with seasonality 12
autoARIMA = AutoARIMA(season_length=12)
# Select ETS with seasonality 12 and multiplicative trend
model = StatsForecast(df=products2.set_index('unique_id'),
models=[autoARIMA],
freq='m', n_jobs=-1)
Y_hat_df = model.forecast(horizon).reset_index()
J T
10/06/2022, 9:16 PMJ T
10/06/2022, 9:20 PMValeriy
10/09/2022, 11:34 AMMax (Nixtla)
10/10/2022, 2:56 PMValeriy
10/11/2022, 9:28 AMValeriy
10/11/2022, 9:29 AMValeriy
10/11/2022, 9:30 AMJ T
10/14/2022, 6:10 PMMax (Nixtla)
10/14/2022, 6:55 PM<https://github.com/Nixtla/statsforecast/blob/main/environment.yml>
Max (Nixtla)
10/14/2022, 6:58 PMconda env create --name statsforecastenv --file=environment.yml
And then
source activate statsforecastenv
Valeriy
10/17/2022, 12:58 PMJ T
10/23/2022, 2:31 AM