Luis Enrique Patiño
08/01/2023, 6:34 PM# Instantiate the MLForecast object
mlf = MLForecast(
models={
'LGBM': LGBMRegressor(),
'XGB' : XGBRegressor(),
'XGB_hiper' : XGBRegressor(),
'LR' : LinearRegression(),
'avg' : LGBMRegressor(**lgb_params),
'q75' : LGBMRegressor(**lgb_params, objective='quantile', alpha=0.75),
'q25': lgb.LGBMRegressor(**lgb_params, objective='quantile', alpha=0.25)
},
freq='W-SUN', # Frequency of the data
lags=[1, 2, 52], # Specific lags to use as regressors
lag_transforms = {
1: [expanding_mean],
1: [(rolling_mean, 3)],
1: [(ewm_mean, 0.5)],
1: [increment_with_previous],
52: [increment_with_previous],
52: [(rolling_mean, 3)]
},
target_transforms=[StandardScaler()],
date_features = ['year', 'month', 'quarter', 'week', 'is_month_start', 'is_month_end'], # Date features to use as regressors
)
static_features = ['holiday']
mlf.fit(train, static_features=static_features)
And when I run the cv
y_pred_cv_mlf = mlf.cross_validation(
train.drop('holiday', axis=1),
window_size=h,
n_windows=2,
step_size=1
)
I get this error:
ValueError: Cross validation result produced less results than expected. Please verify that the frequency set on the MLForecast constructor matches your series' and that there aren't any missing periods.Max (Nixtla)
08/02/2023, 5:36 AMMax (Nixtla)
08/02/2023, 5:18 PMJosé Morales
08/03/2023, 12:54 AMLuis Enrique Patiño
08/03/2023, 7:10 PM