[ANN] MachineLearningForecast.jl: forecasting with any MLJ regressor

MachineLearningForecast.jl: Forecasting with any MLJ regressor

I’m happy to share MachineLearningForecast.jl, a package for time-series forecasting that turns any MLJ Deterministic regressor into a forecaster. EvoTrees, XGBoost, LightGBM, random forests, linear models: nothing is hard-coded, so you bring the learner and the package handles the lag features, the recursion, and the backtesting.

Two things it tries to get right. Features built from the target’s history can only see rows strictly before the target, so leakage is structurally ruled out rather than left to you to check. And setting id= fits one global model across a whole panel of series, so short series borrow strength from the rest.

using MachineLearningForecast, EvoTrees, Dates

fc = Forecaster(
    EvoTreeRegressor(nrounds=200, eta=0.05);
    features = FeatureSet(
        Lag(1), Lag(7),
        RollingMean(7; lag=1),
        Calendar(:dayofweek, :month),
        Fourier(365.25, 3),
        Exogenous(:promo),          # known into the future
    ),
    strategy = Recursive(),          # or Direct(28)
    freq = Day(1), target = :y, time = :ds,
)

fcast = forecast(fit(fc, df), 28; new_data = future_exog)

backtest(fc, df; horizon=28, initial=730, step=28, metrics=(mae, rmse, smape))

Input is anything Tables.jl accepts, and the package itself depends only on Tables.jl. There’s also a tune function that searches over models, feature sets and strategies, scoring candidates by backtest error instead of one-step tabular error.

A warning up front: this is early-stage. It is tested and usable, but young, the API is not stable, and breaking changes are likely. Try it and tell me what breaks, rather than pinning production work to it. Feedback on the API is especially welcome while changing it is still cheap.

Repo: GitHub - Akai01/MachineLearningForecast.jl · GitHub