Esempio n. 1
0
    def error_calculation_test(self):
        """Test the calculation of the MeanSquaredError."""
        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])

        mse = MeanSquaredError()
        mse.initialize(tsOrg, tsCalc)

        self.assertEquals("0.1472", str(mse.get_error())[:6])
Esempio n. 2
0
    def error_calculation_test(self):
        """Test the calculation of the MeanSquaredError."""
        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])

        mse = MeanSquaredError()
        mse.initialize(tsOrg, tsCalc)

        self.assertEquals("0.1472", str(mse.get_error())[:6])
Esempio n. 3
0
    def error_calculation_test(self):
        """Test for a valid error calculation."""
        dataOrg         = [[0,0], [1,1], [2,2], [3,3], [4,4], [5,5], [6,  6], [7,7], [8,8],   [9,9]]
        dataCalc        = [[0,1], [1,3], [2,5], [3,0], [4,3], [5,5], [6.1,6], [7,3], [8.1,8], [9,8]]
        # difference:         1      2      3      3      1      0       NA      4       NA      1
        # local errors:       1      4      9      9      1      0       NA     16       NA      1

        tsOrg  = TimeSeries.from_twodim_list(dataOrg)
        tsCalc = TimeSeries.from_twodim_list(dataCalc)

        tsOrg  = TimeSeries.from_twodim_list(dataOrg)
        tsCalc = TimeSeries.from_twodim_list(dataCalc)

        mse = MeanSquaredError(80.0)
        mse.initialize(tsOrg, tsCalc)

        assert str(mse.get_error()) == "5.125"