diff --git a/nbs/core.ipynb b/nbs/core.ipynb index 3bb61dbdc..51fbc6d41 100644 --- a/nbs/core.ipynb +++ b/nbs/core.ipynb @@ -1546,9 +1546,12 @@ " \"id_col\": self.id_col,\n", " \"time_col\": self.time_col,\n", " \"target_col\": self.target_col,\n", - " \"prediction_intervals\": self.prediction_intervals,\n", - " \"_cs_df\": self._cs_df, # conformity score\n", " }\n", + " for attr in ['prediction_intervals', '_cs_df']:\n", + " # conformal prediction related attributes was not available < 1.7.6\n", + " config_dict[attr] = getattr(self, attr, None)\n", + " \n", + "\n", " if save_dataset:\n", " config_dict.update(\n", " {\n", @@ -1648,8 +1651,7 @@ " setattr(neuralforecast, attr, config_dict.get(attr, default))\n", " # only restore attribute if available\n", " for attr in ['prediction_intervals', '_cs_df']:\n", - " if attr in config_dict.keys():\n", - " setattr(neuralforecast, attr, config_dict[attr])\n", + " setattr(neuralforecast, attr, config_dict.get(attr, None))\n", "\n", " # Dataset\n", " if dataset is not None:\n", diff --git a/neuralforecast/core.py b/neuralforecast/core.py index fffe4bde5..2cd7f53d7 100644 --- a/neuralforecast/core.py +++ b/neuralforecast/core.py @@ -1534,9 +1534,11 @@ def save( "id_col": self.id_col, "time_col": self.time_col, "target_col": self.target_col, - "prediction_intervals": self.prediction_intervals, - "_cs_df": self._cs_df, # conformity score } + for attr in ["prediction_intervals", "_cs_df"]: + # conformal prediction related attributes was not available < 1.7.6 + config_dict[attr] = getattr(self, attr, None) + if save_dataset: config_dict.update( { @@ -1641,8 +1643,7 @@ def load(path, verbose=False, **kwargs): setattr(neuralforecast, attr, config_dict.get(attr, default)) # only restore attribute if available for attr in ["prediction_intervals", "_cs_df"]: - if attr in config_dict.keys(): - setattr(neuralforecast, attr, config_dict[attr]) + setattr(neuralforecast, attr, config_dict.get(attr, None)) # Dataset if dataset is not None: