From c2c8a892f8b48f144c2177905b1102f1b290b050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido=20de=20Lima=20e=20Silva?= Date: Wed, 27 Feb 2019 14:16:18 -0300 Subject: [PATCH] Update ensemble.py --- pyFTS/models/ensemble/ensemble.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyFTS/models/ensemble/ensemble.py b/pyFTS/models/ensemble/ensemble.py index 18e6636..9aa5393 100644 --- a/pyFTS/models/ensemble/ensemble.py +++ b/pyFTS/models/ensemble/ensemble.py @@ -102,9 +102,8 @@ class EnsembleFTS(fts.FTS): l = len(self.models) if l == 1: return forecasts[0] - w = [np.exp(-(l - k)) for k in range(l)] - sw = sum(w) - w = w / sw + w = np.array([np.exp(-(l - k)) for k in range(l)]) + w = w / np.nansum(w) ret = np.nansum([w[k] * forecasts[k] for k in range(l)]) return ret