Skip to content

Commit 3ad522b

Browse files
committed
Use deepcopy of model during the conformity score computation
1 parent 0c6e1e1 commit 3ad522b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

nbs/core.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,10 @@
551551
" )\n",
552552
" if prediction_intervals is not None:\n",
553553
" self.prediction_intervals = prediction_intervals\n",
554-
" self._cs_df = self._conformity_scores(\n",
554+
"\n",
555+
" # copy of model to prevent issue such as https://github.com/Nixtla/neuralforecast/issues/1232\n",
556+
" model_copy = deepcopy(self)\n",
557+
" self._cs_df = model_copy._conformity_scores(\n",
555558
" df=df,\n",
556559
" id_col=id_col,\n",
557560
" time_col=time_col,\n",

neuralforecast/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,10 @@ def fit(
493493
)
494494
if prediction_intervals is not None:
495495
self.prediction_intervals = prediction_intervals
496-
self._cs_df = self._conformity_scores(
496+
497+
# copy of model to prevent issue such as https://github.com/Nixtla/neuralforecast/issues/1232
498+
model_copy = deepcopy(self)
499+
self._cs_df = model_copy._conformity_scores(
497500
df=df,
498501
id_col=id_col,
499502
time_col=time_col,

0 commit comments

Comments
 (0)