Let's start from theory. A futures is a standardized forward. In principle, its price should be
\begin{align}
F_{0,T} &:= \exp(r_{n0} T) E_0^Q(S_T) = \exp(r_{n0} T) S_0 \\
r_{n0} &:= \text{risk-free rate} + \text{storage cost} - \text{dividend yield} - \text{convenience yield}
\end{align}
where $Q$ is the risk-neutral measure and $(S_t)_{t \geq 0}$ is the price process of your asset. That equation follows from the absence of arbitrage.
One thing you could assume is that the equation does not hold exactly and the gap in $h \geq 1$ is predictable and depends on prior gaps. For example, you could write an error correction model for the rate of return on stocks: after all, if you take logarithms above and add a distrubtance term, the log forward price and log stock prices should be cointegrated, in fact with a cointegration vector of (1,-1).
\begin{align}
lnS_{t+1} - lnS_t = \phi_0 + \beta(lnF_{t,1} - lnS_t) + \sum_{i=1}^{p_s} \phi_{si} (lnS_{t-i} - lnS_{t-1-i}) + \sum_{i=1}^{p_f} \phi_{fi} (ln F_{t-i,1} - ln F_{t-1-i,1}) + \epsilon_{t+1}.
\end{align}
This can be estimated by ordinary least square and you can easily choosen the hyperparameters $(p_s,p_f)$ by using an information criteria like the BIC or by cross-validation. Even if you deal with time series, K-fold would be asymptotically valid (Bergmeir, Hyndman and Koo, 2015) and, in practice, it accounting for the time dependency in the the CV doesn't really matter either (Goulet-Coulombe, Leroux, Stevanovic and Surprenant, 2020), although I don't see the point of using that kind of slow method when you work with a linear parametric model -- the BIC should work just fine.
The above model essentially says that the arbitrage restriction holds, but only in the long run. It's not super-sophisticated and, yes, you could use the same regressors in non-linear models such as support vector regressions, kernel ridge regressions or neural networks to try to improve performance. Personally, I'd go for KRR, perhaps with a 2nd or 3rd degree polynomial kernel: it's going to prevent you from choosing the relevant regressors, it's going to allow plenty of nonlinearity and it's simple enough to code.
Note that the model I proposed imposes a restriction. It is assuming that whatever is making the prices of both futures and stock prices grow over the long run is the same (stochastic) trend. It might not hold true. One thing you could do is to compare (i) working directly with prices, (ii) exploiting the possible cointegration between futures and prices for the underlying and (iii) predict logarithmic growth rates and use them to recover prices using the current levels of prices.
This way, you get to penalize everything in the same manner and you get to see whether it's worth imposing some of those restrictions or not. Moreover, the loss you compute is an estimate of conditional expectations in all cases and that should be fine -- as long as the forecast horizon doesn't become absurdly long versus the sample frequency, the error on that expectation should be covariance stationnary (although, serially correlated if you do multiple step forecasting because you'll have overlapping errors).