diff --git a/CHANGELOG.md b/CHANGELOG.md index a47a2faaaa..81a6981b8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ but cannot always guarantee backwards compatibility. Changes that may **break co **Fixed** +- Fixed `examples/14-transfer-learning.ipynb` raising a NaN error on the `air` dataset: the `load_air()` helper now calls `fill_missing_values(..., fill="auto")` after `longest_contiguous_slice()` to handle residual gaps in the raw `carrier_passengers.csv`. Closes [#2752](https://github.com/unit8co/darts/issues/2752). + **Dependencies** ### For developers of the library: diff --git a/examples/14-transfer-learning.ipynb b/examples/14-transfer-learning.ipynb index 579e6a5521..089e9e5bec 100644 --- a/examples/14-transfer-learning.ipynb +++ b/examples/14-transfer-learning.ipynb @@ -130,7 +130,8 @@ " RandomForestModel,\n", " Theta,\n", ")\n", - "from darts.utils.losses import SmapeLoss" + "from darts.utils.losses import SmapeLoss\n", + "from darts.utils.missing_values import fill_missing_values" ] }, { @@ -244,6 +245,11 @@ " series = series.longest_contiguous_slice()\n", " except Exception:\n", " continue\n", + " # Fill any residual missing values inside the chosen slice. The raw\n", + " # carrier_passengers.csv occasionally has gaps that survive the\n", + " # longest_contiguous_slice() call (e.g. zero-rows), which produce NaNs\n", + " # downstream and break model training. See issue #2752.\n", + " series = fill_missing_values(series, fill=\"auto\")\n", " # remove static covariates\n", " series = series.with_static_covariates(None)\n", " # remove short series\n",