diff --git a/book/machinelearning/timeseries.ipynb b/book/machinelearning/timeseries.ipynb index 16a0af1..d257926 100644 --- a/book/machinelearning/timeseries.ipynb +++ b/book/machinelearning/timeseries.ipynb @@ -307,6 +307,62 @@ "\n", "scores = mase(y_true=y_test, y_pred=y_pred, y_train=y_train)" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Time Series Forecasting with Deep Learning with `neuralforecast`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Do you want to perform powerful time series forecasting?\n", + "\n", + "Try `neuralforecast` by nixtla.\n", + "\n", + "`neuralforecast` lets you run Deep Learning models for time series forecasting with models like N-BEATS or N-HiTS.\n", + "\n", + "Support for exogenous variables and probabilistic forecasting are also included.\n", + "\n", + "Check the example below!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pip install neuralforecast" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "\n", + "from neuralforecast import NeuralForecast\n", + "from neuralforecast.models import NBEATS, NHITS\n", + "from neuralforecast.utils import AirPassengersDF\n", + "\n", + "Y_df = AirPassengersDF\n", + "Y_train_df = Y_df[Y_df.ds<='1959-12-31']\n", + "Y_test_df = Y_df[Y_df.ds>'1959-12-31']\n", + "\n", + "horizon = 12\n", + "models = [NBEATS(input_size=2 * horizon, h=horizon, max_steps=50),\n", + " NHITS(input_size=2 * horizon, h=horizon, max_steps=50)]\n", + "\n", + "nf = NeuralForecast(models=models, freq='M')\n", + "nf.fit(df=Y_train_df)\n", + "Y_hat_df = nf.predict().reset_index()" + ] } ], "metadata": {