From f9b910587aee15445179e5f4efe42e432b7a8a61 Mon Sep 17 00:00:00 2001 From: nepslor Date: Thu, 14 Dec 2023 16:49:52 +0100 Subject: [PATCH] corrected restoring of saved pars --- pyforecaster/forecasting_models/neural_forecasters.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyforecaster/forecasting_models/neural_forecasters.py b/pyforecaster/forecasting_models/neural_forecasters.py index f148019..4783dc4 100644 --- a/pyforecaster/forecasting_models/neural_forecasters.py +++ b/pyforecaster/forecasting_models/neural_forecasters.py @@ -315,10 +315,10 @@ def fit(self, inputs, targets, n_epochs=None, savepath_tr_plots=None, stats_step k += 1 if finished: break - if len(val_loss)>1: - if val_loss[-1] > val_loss[-2]: - pars = old_pars - self.pars = pars + if len(val_loss)>2: + if val_loss[-1] > val_loss[-2]: + pars = old_pars + self.pars = pars super().fit(inputs_val_0, targets_val_0) return self