Update ensemble.py

This commit is contained in:
Petrônio Cândido de Lima e Silva 2019-02-27 14:16:18 -03:00 committed by GitHub
parent c559c1050d
commit c2c8a892f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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