Hi there, I'm stacking two models to make my forec...
# mlforecast
s
Hi there, I'm stacking two models to make my forecast. For example the first model only forecast from T to T+5 and the second one for T+6 to T+24. I have y that's available up to T-1. The reason I'm splitting them is I have some features that are very useful only up to T+5 but not beyond that and from T+6 to T+24 I have another group of features which is more stable, essentially two groups of features. So what I'm trying to figure out is I want to make the gap between T+5 and T+6 as smooth as possible, thus I update the second model with prediction generated from the first model, specifically T to T+5, but I'm still seeing "gaps", such as huge drops or increase in scale, from time to time. I look into the source code of
MLForecast.update
and it seems like all it does is update the stored ts. I'm wondering how does update even help in this case except I have
RollingMean(window_size=3)
in the feature frame, which I assume it got calculated based on T+3 to T+5 I fed in for T+6, and so on. Could you please confirm I'm understanding correctly? I would really appreciate if you have any other insights about how to "smoothly connect" two forecast.
both models are lgbm btw if that helps.
j
hey. can you provide an example of what you're doing? do you have two mlforecast instances trained on the same data?
s
yes I have two different models trained on the same target but different feature frame. here's a pseudo code
Copy code
fcst1 = MLForecast(models = {'modelA':lgb.LGBMRegressor(**lgb_params)})
fcst2 = MLForecast(models = {'modelB':lgb.LGBMRegressor(**lgb_params)},
            lag_transforms={  
                3: [RollingMean(window_size=3)],
            },)
fcst1.fit(df1)
fcst2.fit(df2)#y in df1 and df2 are the same
pred = fcst1.predict(h=5, X_df=cov1)
fcst2.update(pred)
fcst2.predict(h=19, X_df=cov2)
j
yeah that looks ok. so the problem is that the second model produces weird predictions?
s
yes especially the first index. It looks very different in scale whereas I am expecting it to be roughly the same as previous index, i.e. the last index in update.
is there anyway I can check how the updated ts being used to calculate rolling mean? and could you confirm that's the only effect of using update function?
j
the update method appends the new target values to the stored ones and updates the last training dates. the rolling mean looks at the last window_size samples of each serie, which after updating should be your predictions
s
yes that sounds aligning with my understanding.
j
are you using target transformations?
s
no. I'm not applying any transformation on target or features
j
can you try without exogenous features? just to see if they look better
s
sure
that's also my thought - probably some features are causing it.