Closed melissafeeney closed 5 months ago
Interestingly, changing the freq
parameter when fitting the fcst object to 'W-MON' may have solved the issue! This runs without issue:
from sklearn.ensemble import RandomForestRegressor
train = data.loc[0:130]
test = data.loc[131:]
models = RandomForestRegressor(random_state=0, n_estimators = 100)
fcst = MLForecast(models=models, freq = 'W-MON')
fcst.fit(train, fitted = True, static_features=[])
preds = fcst.predict(h = 24, X_df = test[['unique_id', 'ds', 'holiday']])
Hey @melissafeeney, thanks for using mlforecast. We use the freq
argument to build the future dates, so it must match the frequency of your series ('W-MON' in this case is the correct one). We're glad the debugging methods helped you figure out the problem.
I am training a simple time series model, and my dataset includes 1 dynamic exogenous variable (holiday) and no static exogenous variables. The training set contains 131 weeks of data, and the test set contains 24 weeks of data. Each week starts on a Monday.
The training dataset looks like this:
The test dataset looks like this:
I am running this first train a forecasting model on my training data, after which I want to test it on my test data. Even though my test data contains unique_id, ds, and holiday (the dynamic exogenous variable), I get an error:
If I try to use the suggestions in the error to create X_df using fcst.make_future_dataframe(h) but when I do that, the ds dates transform into Sundays (instead of Mondays as they are in my train and test datasets).
If I try to use the suggestions in the error to use fcst.get_missing_future(h, X_df), I get this- and also notice how the dates changed from Monday into Sundays...:
Versions / Dependencies
I am using Google colab and installed MLforecast from pip as well as from source as suggested from another issue @298:
! pip install git+https://github.com/Nixtla/mlforecast
version: mlforecast-0.11.6
Reproduction script
Issue Severity
High: It blocks me from completing my task.