コード例 #1
0
    def calculate_historic_means_test(self):
        """Test the calculation of the historic means."""
        dataOrg = [[1.0, 10], [2.0, 12], [3.0, 14], [4.0, 13], [5.0, 17], [6.0, 20], [7.0, 23], [8.0, 26], [9.0, 29], [10.0, 31], [11.0, 26], [12.0, 21], [13.0, 18], [14.0, 14], [15.0, 13], [16.0, 19], [17.0, 24], [18.0, 28], [19.0, 30], [20.0, 32]]
        #                           2          2          1          4          3          3          3          3           2           5           5           3           4           1           6           5           4           2           2
        # Sum(History)                                                         12         13         14         16          14          16          18          18          19          18          19          19          20          18          19
        correctResult = [                                                      2.4,       2.6,       2.8,       3.2,        2.8,        3.2,        3.6,        3.6,        3.8,        3.6,        3.8,        3.8,        4.0,        3.6]

        tsOrg = TimeSeries.from_twodim_list(dataOrg)
        mase  = MeanAbsoluteScaledError(historyLength=5)
        result = mase._get_historic_means(tsOrg)

        assert result == correctResult
コード例 #2
0
    def calculate_historic_means_test(self):
        """Test the calculation of the historic means."""
        dataOrg = [[1.0, 10], [2.0, 12], [3.0, 14], [4.0, 13], [5.0, 17], [6.0, 20], [7.0, 23], [8.0, 26], [9.0, 29], [10.0, 31], [11.0, 26], [12.0, 21], [13.0, 18], [14.0, 14], [15.0, 13], [16.0, 19], [17.0, 24], [18.0, 28], [19.0, 30], [20.0, 32]]
        #                           2          2          1          4          3          3          3          3           2           5           5           3           4           1           6           5           4           2           2
        # Sum(History)                                                         12         13         14         16          14          16          18          18          19          18          19          19          20          18          19
        correctResult = [                                                      2.4,       2.6,       2.8,       3.2,        2.8,        3.2,        3.6,        3.6,        3.8,        3.6,        3.8,        3.8,        4.0,        3.6]

        tsOrg = TimeSeries.from_twodim_list(dataOrg)
        mase  = MeanAbsoluteScaledError(historyLength=5)
        result = mase._get_historic_means(tsOrg)

        assert result == correctResult