diff --git a/benchmarks.py b/benchmarks.py index b92776c..a40368f 100644 --- a/benchmarks.py +++ b/benchmarks.py @@ -13,18 +13,20 @@ def Teste(par): plt.plot(x,y) # Erro quadrático médio -def rmse(forecastions,targets): - return np.sqrt(np.mean((forecastions-targets)**2)) +def rmse(forecasts,targets): + return np.sqrt(np.nanmean((forecasts-targets)**2)) # Erro Percentual médio -def mape(forecastions,targets): - return np.mean(abs(forecastions-targets)/forecastions) +def mape(forecasts,targets): + return np.mean(abs(forecasts-targets)/forecasts) def plotComparedSeries(original,fts,title): fig = plt.figure(figsize=[20,6]) ax = fig.add_subplot(111) - forecasted = [fts.forecast(xx) for xx in original] - error = rmse(original,forecasted) + forecasted = fts.forecast(original) + #error = rmse(original[1:],forecasted[0:-1]) + forecasted.insert(0,None) + #np.append(original,[None]) ax.plot(original,color='b',label="Original") ax.plot(forecasted,color='r',label="Predicted") handles0, labels0 = ax.get_legend_handles_labels() diff --git a/chen.py b/chen.py index 07615ec..1eae509 100644 --- a/chen.py +++ b/chen.py @@ -48,7 +48,7 @@ class ConventionalFTS(fts.FTS): ret = [] - for k in np.arange(1,l): + for k in np.arange(0,l): mv = common.fuzzyInstance(ndata[k], self.sets) diff --git a/ismailefendi.py b/ismailefendi.py index 0474a40..8787ae2 100644 --- a/ismailefendi.py +++ b/ismailefendi.py @@ -64,7 +64,7 @@ class ImprovedWeightedFTS(fts.FTS): ret = [] - for k in np.arange(1,l): + for k in np.arange(0,l): mv = common.fuzzyInstance(ndata[k], self.sets) diff --git a/sadaei.py b/sadaei.py index b18fc7e..15ae6e3 100644 --- a/sadaei.py +++ b/sadaei.py @@ -61,7 +61,7 @@ class ExponentialyWeightedFTS(fts.FTS): ret = [] - for k in np.arange(1,l): + for k in np.arange(0,l): mv = common.fuzzyInstance(ndata[k], self.sets) diff --git a/yu.py b/yu.py index 74d2d64..58ae51a 100644 --- a/yu.py +++ b/yu.py @@ -57,7 +57,7 @@ class WeightedFTS(fts.FTS): ret = [] - for k in np.arange(1,l): + for k in np.arange(0,l): mv = common.fuzzyInstance(ndata[k], self.sets)