Ejemplo n.º 1
0
 def test_C03T01_core(self):
     """ Loads plugin from FeatureEng using parameters from setup_method() and Asses that output file has 1 column and num_ticks - forward_ticks """
     self.fe = FeatureEng(self.conf)
     # get the number of rows and cols from out_file
     rows_o, cols_o = self.get_size_csv(self.conf.output_file)
     # assertion
     assert (cols_o == self.fe.ep_core.cols_d * self.conf.num_components)
Ejemplo n.º 2
0
 def test_C02T01_core(self):
     """ Loads HeuristicTS using parameters from setup_method() and Asses that output file has 1 column and num_ticks - forward_ticks """
     self.fe = FeatureEng(self.conf)
     # get the number of rows and cols from out_file
     rows_o, cols_o = self.get_size_csv(self.conf.output_file)
     # assertion
     assert (cols_o == 1) and (rows_o == self.fe.ep_core.rows_d - self.fe.ep_core.conf.forward_ticks)
Ejemplo n.º 3
0
 def test_C01T01_list_plugins(self):
     """ Asses that plugin list has more than zero installed plugins """
     self.conf.list_plugins = True
     self.fe = FeatureEng(self.conf)
     """ FeatureEng instance """
     # assertion
     assert (len(self.fe.discovered_core_plugins) > 0)
Ejemplo n.º 4
0
 def atest_C04T01_core(self):
     """ Loads plugin from FeatureEng using parameters from setup_method() and Asses that output file has same number of columns but less rows  """
     self.fe = FeatureEng(self.conf)
     # get the number of rows and cols from out_file
     rows_o, cols_o = self.get_size_csv(self.conf.output_file)
     # assertion
     assert (cols_o == self.cols_d) and (
         rows_o == self.rows_d -
         (2 * (self.conf.window_size + self.conf.forward_ticks)))
Ejemplo n.º 5
0
    def test_C04T05_svht_variable_window_size(self):
        """ manual test for plotting the error (r2 coeff) for a variable window_size """
        error_list = []
        for window_size in range(6, 9, 1):
            # re-instance class with the new configuration
            conf = Conf()
            # use the output of the test 5 of the heuristic_ts component as input since it has 10k rows = 10 times the maximum window size
            conf.input_file = os.path.join(os.path.dirname(__file__),
                                           "data/test_c02_t04_output_std.csv")
            # plot prefix to generate a plot per test iteration
            conf.plot_prefix = os.path.join(
                os.path.dirname(__file__),
                "plots/6_9_c04t05_" + str(window_size) + "_")
            # use svht for auto selecting the number of components per window_size
            conf.num_components = 0
            # setup window_size configuration parameters
            conf.window_size = window_size
            # instance class, previous 1
            conf.forward_ticks = 1
            fe = FeatureEng(conf)
            # save the error for plotting
            err = fe.ep_core.error
            if err < -2:
                err = -2 + ((err + 2) / 1000)

            error_list.append(err)
            del fe
            del conf
        # plots the error for each window size
        fig, ax = plt.subplots(figsize=(18, 7))
        ax.plot(range(6, 9, 1),
                error_list,
                lw=3,
                c='steelblue',
                alpha=0.8,
                label='r2 score')
        ax.legend()
        fig.savefig(os.path.join(os.path.dirname(__file__),
                                 "plots/6_9_c04t05_variable_window_size.png"),
                    dpi=600)
        # get the size of the output dataset
        rows_d, cols_d = self.get_size_csv(
            os.path.join(os.path.dirname(__file__),
                         "data/test_c02_t04_output.csv"))
        # get the size of the output dataset
        rows_o, cols_o = self.get_size_csv(self.conf.output_file)
        # assert if there are 3 groups per feature in the output dataset
        assert (cols_o == cols_d) and (rows_o < rows_d)