Hi team. I am using `PredictionIntervals` for my m...
# mlforecast
m
Hi team. I am using
PredictionIntervals
for my mlforecast model to get prediction intervals. Can someone please explain how to choose the
h
and
n_windows
values since it seems to be different from cross-validation? I am having a training dataset of 63 days and wish to predict for a horizon on 31 days. I am using the below models and when I set
prediction_intervals=PredictionIntervals(h=10, n_windows=2)
,
.fit()
fails with an error that
Copy code
ValueError: Found array with 0 sample(s) (shape=(0, 6)) while a minimum of 1 is required by KNeighborsRegressor.
Copy code
models = {
    'KNeighborsRegressor': KNeighborsRegressor(),
    'Lasso': Lasso(),
    'LinearRegression': LinearRegression(),
    'MLPRegressor': MLPRegressor(),
    'Ridge': Ridge(),
    'DT': DecisionTreeRegressor(),
    'avg': lgb.LGBMRegressor(**lgb_params),
    'q75': lgb.LGBMRegressor(**lgb_params, objective='quantile', alpha=0.75),
    'q25': lgb.LGBMRegressor(**lgb_params, objective='quantile', alpha=0.25)
}
j
Which features are you using? The dropna arguments defaults to true, so if you have lag 10 for example then 10 rows would be dropped
m
lags=[1, 7, 31], lag_transforms={ 1: [ExpandingMean()], 7: [RollingMean(window_size=7)], 31: [RollingMean(window_size=31)], }
j
The first window of cv has 63 - 2 * 10 = 43 training samples. The lag31 will drop 31 rows, so that'd leave you with 11 training samples, however the RollingMean has a min_samples argument which if not set will default to the window size, so that one produces 62 NaNs. You can try setting
RollingMean(window_size=31, min_samples=1)
👍 1
m
Thank you for that 👍, that's helpful. I will try it and get back in case of any issues. Is this part 'however the RollingMean has a min_samples argument which if not set will default to the window size' mentioned anywhere in the documentation?
j
It's in the docstring
👍 1