Skip to main content

Prerequisites

This notebook was ran in databricks using the following configuration:
  • Databricks Runtime Version: 14.3 LTS ML (Spark 3.5, GPU, Scala 2.12)
  • Worker and executors instance type: g4dn.xlarge
  • Cluster libraries:
    • neuralforecast==1.7.0
    • fugue
    • protobuf<=3.20.1
    • s3fs

Load libraries

Data

Configuration

Model training

Forecasting

When we’re done training the model in a distributed way we can predict using the stored dataset. If we have future exogenous features we can provide a spark dataframe as futr_df. Note that if you want to load the stored dataset you need to provide the spark session through the engine argument.
We can also provide a spark dataframe as df as well as static_df and futr_df (if applicable) to compute predictions on different data or after loading a saved model.
Either of the above methods will yield the same results.

Saving for inference

We can now persist the trained models
And load them back
We can now use this object to compute forecasts. We can provide either local dataframes (pandas, polars) as well as spark dataframes

Evaluation

NHITStuned_nhitsLSTM
metric
mae417.075336322.751522270.423775
rmse485.304941410.998659330.579283
smape0.0639950.0660460.063975

Plotting a sample