Skip to content

Commit

Permalink
Add neuralforecast
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Dec 24, 2023
1 parent dc6d256 commit ee8abe3
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions book/machinelearning/timeseries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit ee8abe3

Please sign in to comment.