Bugfix on IncrementalEnsembleFTS

This commit is contained in:
Petrônio Cândido 2019-02-27 10:44:10 -03:00
parent f7c1b4443e
commit 05c1f9f9da
2 changed files with 4 additions and 2 deletions

View File

@ -104,7 +104,7 @@ class EnsembleFTS(fts.FTS):
elif self.point_method == 'exponential': elif self.point_method == 'exponential':
l = len(self.models) l = len(self.models)
if l == 1: if l == 1:
return forecasts return forecasts[0]
ret = np.nansum([np.exp(-(self.exp_factor * (l - k))) * forecasts[k] for k in range(l)]) ret = np.nansum([np.exp(-(self.exp_factor * (l - k))) * forecasts[k] for k in range(l)])
return ret return ret

View File

@ -19,7 +19,9 @@ model = IncrementalEnsemble.IncrementalEnsembleFTS(order=2, window_length=20, ba
model.fit(passengers[:40]) model.fit(passengers[:40])
model.predict(passengers[40:]) forecasts = model.predict(passengers[40:])
print(forecasts)
''' '''
passengers = np.array(passengers["Passengers"]) passengers = np.array(passengers["Passengers"])