From 8a01256185b6bc3c121243400cb6de89ef7e38f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Wed, 27 Feb 2019 15:11:51 -0300 Subject: [PATCH] Refactorings on IncrementalEnsemble --- pyFTS/models/incremental/IncrementalEnsemble.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pyFTS/models/incremental/IncrementalEnsemble.py b/pyFTS/models/incremental/IncrementalEnsemble.py index c4ea174..c494054 100644 --- a/pyFTS/models/incremental/IncrementalEnsemble.py +++ b/pyFTS/models/incremental/IncrementalEnsemble.py @@ -65,18 +65,20 @@ class IncrementalEnsembleFTS(ensemble.EnsembleFTS): ret = [] - for k in np.arange(0, l): + for k in np.arange(self.max_lag, l): - data_window.append(data[k]) + k2 = k - self.max_lag - if k >= self.window_length: + data_window.append(data[k2]) + + if k2 >= self.window_length: data_window.pop(0) - if k % self.batch_size == 0 and k >= self.window_length: + if k % self.batch_size == 0 and k2 >= self.window_length: self.train(data_window, **kwargs) if len(self.models) > 0: - sample = data[k: k + self.max_lag] + sample = data[k2: k] tmp = self.get_models_forecasts(sample) point = self.get_point(tmp) ret.append(point)