Iva Eftimska
09/26/2023, 8:55 AMJosé Morales
09/26/2023, 4:06 PMdropna=True
(the default) the preprocessing drops 864 rows, which may be too many for your data. Also if your data has trend the random forest can't extrapolate out of the box, so you could use differences for exampleIva Eftimska
09/26/2023, 7:06 PMJosé Morales
09/26/2023, 8:26 PMIva Eftimska
09/26/2023, 9:03 PMJosé Morales
09/26/2023, 9:05 PMIva Eftimska
09/26/2023, 9:11 PMJosé Morales
09/26/2023, 10:15 PMfrom mlforecast.target_transforms import Differences
model = MLForecast(models=models,
freq='5T',
lags=[1, 12 * 24, 7 * 12 * 24],
date_features=['dayofweek', 'month'],
target_transforms=[Differences([7 * 12 * 24])],
num_threads=2)
This assumes that there's a weekly seasonality, so we subtract the value at the same time in the previous week. Using that I see a better forecast:
from utilsforecast.plotting import plot_series
plot_series(predictions, target_col='RandomForestRegressor')
plot_series(dataset_train, predictions, max_insample_length=28 * 24 * 14)
Iva Eftimska
09/27/2023, 8:43 AMJosé Morales
09/27/2023, 3:50 PMIva Eftimska
09/27/2023, 3:57 PMJosé Morales
09/27/2023, 4:04 PM