Análise de Resíduos

This commit is contained in:
Petrônio Cândido de Lima e Silva 2017-01-20 13:49:44 -02:00
parent 46b74be9f9
commit b0fd83a839

View File

@ -5,14 +5,14 @@ import numpy as np
import pandas as pd import pandas as pd
import matplotlib as plt import matplotlib as plt
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from pyFTS.common import Transformations from pyFTS.common import Transformations,Util
def residuals(targets, forecasts, order=1): def residuals(targets, forecasts, order=1):
return np.array(targets[order:]) - np.array(forecasts[:-order]) return np.array(targets[order:]) - np.array(forecasts[:-order])
def plotResiduals(targets, forecasts, order=1, tam=[8, 8]): def plotResiduals(targets, forecasts, order=1, tam=[8, 8], save=False, file=None):
res = residuals(targets,forecasts,order) res = residuals(targets,forecasts,order)
fig = plt.figure(figsize=tam) fig = plt.figure(figsize=tam)
ax1 = fig.add_axes([0, 1, 0.9, 0.3]) # left, bottom, width, height ax1 = fig.add_axes([0, 1, 0.9, 0.3]) # left, bottom, width, height
@ -22,3 +22,5 @@ def plotResiduals(targets, forecasts, order=1, tam=[8, 8]):
ax3 = fig.add_axes([0, 0.3, 0.9, 0.3]) ax3 = fig.add_axes([0, 0.3, 0.9, 0.3])
ax3.hist(res) ax3.hist(res)
Util.showAndSaveImage(fig, file, save)