From 46b74be9f98804f14b806097cfab2687044b2b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido=20de=20Lima=20e=20Silva?= Date: Thu, 19 Jan 2017 23:24:44 -0200 Subject: [PATCH] =?UTF-8?q?An=C3=A1lise=20de=20Res=C3=ADduos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- benchmarks/ResidualAnalysis.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 benchmarks/ResidualAnalysis.py diff --git a/benchmarks/ResidualAnalysis.py b/benchmarks/ResidualAnalysis.py new file mode 100644 index 0000000..ebba1bd --- /dev/null +++ b/benchmarks/ResidualAnalysis.py @@ -0,0 +1,24 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- + +import numpy as np +import pandas as pd +import matplotlib as plt +import matplotlib.pyplot as plt +from pyFTS.common import Transformations + + +def residuals(targets, forecasts, order=1): + return np.array(targets[order:]) - np.array(forecasts[:-order]) + + +def plotResiduals(targets, forecasts, order=1, tam=[8, 8]): + res = residuals(targets,forecasts,order) + fig = plt.figure(figsize=tam) + ax1 = fig.add_axes([0, 1, 0.9, 0.3]) # left, bottom, width, height + ax1.plot(res) + ax2 = fig.add_axes([0, 0.65, 0.9, 0.3]) + ax2.acorr(res) + ax3 = fig.add_axes([0, 0.3, 0.9, 0.3]) + ax3.hist(res) +