def local_error_test(self): """Test MeanAbsolutePercentageError.local_error.""" localErrors = [20, 13.043, 400, 25, 50, None, 100, 200, 200, 250, None] mape = MeanAbsolutePercentageError() for i in xrange(len(self.dataOrg)): calc_local_error = mape.local_error([self.dataOrg[i]], [self.dataCalc[i]]) if calc_local_error: self.assertEquals("%.3f" % calc_local_error,"%.3f" % localErrors[i]) else: self.assertEquals(localErrors[i], None)
def error_calculation_test(self): """Test the calculation of the MeanAbsolutePercentageError.""" tsOrg = TimeSeries() tsCalc = TimeSeries() for idx in xrange(len(self.dataOrg)): tsOrg.add_entry(float(idx), self.dataOrg[idx]) tsCalc.add_entry(float(idx), self.dataCalc[idx]) mape = MeanAbsolutePercentageError() mape.initialize(tsOrg, tsCalc) self.assertEquals("139.78", str(mape.get_error())[:6])
def error_calculation_test(self): """Test the calculation of the MeanAbsolutePercentageError.""" tsOrg = TimeSeries() tsCalc = TimeSeries() for idx in range(len(self.dataOrg)): tsOrg.add_entry(float(idx), self.dataOrg[idx]) tsCalc.add_entry(float(idx), self.dataCalc[idx]) mape = MeanAbsolutePercentageError() mape.initialize(tsOrg, tsCalc) self.assertEquals("139.78", str(mape.get_error())[:6])
def local_error_test(self): """Test MeanAbsolutePercentageError.local_error.""" localErrors = [20, 13.043, 400, 25, 50, None, 100, 200, 200, 250, None] mape = MeanAbsolutePercentageError() for i in range(len(self.dataOrg)): calc_local_error = mape.local_error([self.dataOrg[i]], [self.dataCalc[i]]) if calc_local_error: self.assertEquals("%.3f" % calc_local_error, "%.3f" % localErrors[i]) else: self.assertEquals(localErrors[i], None)