Vítor Barbosa
08/15/2024, 8:26 PMJosé Morales
08/15/2024, 8:28 PMcv_models_
attribute
• Yes, that's the way the splits are done, unless you set a different step size (the default is the horizon). This can be inspected in the cutoff
column from the CV resultVítor Barbosa
08/15/2024, 8:34 PMJosé Morales
08/15/2024, 8:35 PMMLForecast.cross_validation_fitted_values()
to extract themVítor Barbosa
08/15/2024, 8:40 PMVítor Barbosa
08/15/2024, 8:47 PMVítor Barbosa
08/15/2024, 9:15 PMcv_models_
but couldn't get it to predict for new data. If I pass it to a new MLForecast it gives the same error:
forecast_ml_cv_model = forecast_ml.cv_models_[0]['LinearRegression']
forecast_ml_cv = MLForecast(models=[forecast_ml_cv_model],
lags=range(1, horizon+1),
lag_transforms={
1: [ExpandingMean()],
horizon: [RollingMean(window_size=horizon)],
},
freq='B')
I am not sure on how to pass the data for the sklearn model without encapsulating it in the MLForecast()José Morales
08/15/2024, 9:39 PMutilsforecast.processing.backtest_splits
function to get them. It returns cutoffs, train, valid
To predict with the cv models you can do something like this:
orig_models = forecast_ml_cv.models
forecast_ml_cv.models = forecast_ml_cv.cv_models_[0]
forecast_ml_cv.predict(...)
forecast_ml_cv.models = orig_models
Vítor Barbosa
08/16/2024, 3:23 PMVítor Barbosa
08/16/2024, 3:25 PMJosé Morales
08/16/2024, 5:00 PMimport logging
logging.getLogger('pytorch_lightning').setLevel(logging.ERROR)
for the progress bar you can disable it on the model constructor by setting enable_progress_bar=False
Vítor Barbosa
08/17/2024, 4:55 PM