https://github.com/nixtla logo
m

Maria

12/13/2022, 4:05 PM
Hi! I want to know where the fit function is done in cross-validation? maybe if I want to change the optimization function for training. Here is my implementation part: " models = [ADIDA(), IMAPA(), CrostonClassic(), CrostonSBA(), CrostonOptimized(), TSB(alpha_d=0.5, alpha_p=0.5)] fcst = StatsForecast(df=df_to_process, models=models, freq='W-MON', n_jobs=-1) crossvalidation_df = fcst.cross_validation( df = df_to_process, h = 8, step_size = 1, n_windows = 7, sort_df=True ) "
m

Max (Nixtla)

12/13/2022, 4:10 PM
Hi @Maria! To optimize speed, the cross-validation method does not have a fit predict architecture. However, if you are interested in the in-sample predictions, you can use the
StatsForecast.cross_validation_fitted_values
method.
Copy code
After executing StatsForecast.cross_validation, you can access the insample prediction values for each model and window. To get them, you need to pass fitted=True to the StatsForecast.cross_validation method and then use the StatsForecast.cross_validation_fitted_values method.
Ref: https://nixtla.github.io/statsforecast/core.html#statsforecast.cross_validation
🙌 1
m

Maria

12/15/2022, 8:17 AM
Thank you, @Max (Nixtla)!