Hi guys, does `MLForecast` support historic covari...
# mlforecast
v
Hi guys, does
MLForecast
support historic covariates? If so, how can we supply it? I can only find mention and explanation for static and future covariates.
j
Hey. It doesn't make that distinction but you can provide lags of the covariates that are bigger than your forecast horizon (which would do the same as neuralforecast does)
v
Do you have a quick example? How bigger than the horizon should I make them?
j
I believe you can follow this guide. If your horizon is 10 for example you could use up to lag 10 of your historic exogenous features, so that in your last forecast window you use the value at the last training date
v
Is that as effective/accurate as using true past covariates? If I provide lag=1, for h=10, I believe it would complain about missing values, and if I provide lag=10, then the 9 first predicted points won't have the latest covariates, right?
j
If you have the latest values then you should provide those
v
By latest I mean the latest values available at the time of prediction
j
I think we need to take a step back and define historic covariates. In neuralforecast (which I'm guessing is where you get the definition from) these mean "covariates for which we won't know their values at the timestamps that we want to predict, but which we do for the values at the training timestamps", and what neuralforecast does is offset those features by your forecasting horizon, so at each timestamp t you'll use the value for those covariates at t - h, so that when you compute your forecasts the last forecast step uses the last known values. That's exactly the same as using the h-th lag of your covariates in mlforecast
v
Thanks for the explanation! My understanding was that the h next predictions f(t)...(f(t+h-1) using past covariates g would be f(t | g(t-1)), f(t+1 | g(t-1)), ... f(t+h-1 | g(t-1)), i.e., you would always use the latest available past covariate
j
No, in neuralforecast the model is trained to learn how to use the last known value of the historic covariates at that timestamp (so h periods before) to predict the next value of the target. The "future exogenous" are used at the same timestamp as the prediction. With either neural or mlforecast you can also build your own features (with the guide I linked) that are a specific number of timestamps behind your target (by manually creating the lags)
v
Ok then, I will try to do that! Btw, do you know if the method neuralforecast uses is the same type of implementation used on Darts ?
j
I don't know for sure but based on this it seems like they do the same
If these past covariates happen to also be known into the future, then these models are also able to produce forecasts for
n > output_chunk_length
That'd mean that after
output_chunk_length
(similar to our
h
) it'd start using future values of the historic covariates
v
That makes sense, thank you!!