Ejemplo n.º 1
0
    def objective_function(self, subset, **kwargs):
        r"""Evaluates objective function on specified subset. Returns distance
        between self.goal and the series in subset

        Notes
        -----
        self.objective must match the name of a function in
        objective_functions.py

        Parameters
        ----------
        subset : list
            subset of data dictionaries from data

        Returns
        -------
        return : float
            a measure of distance

        """
        subset = dm.listify(subset)
        if hasattr(objective_functions, self.objective):
            return eval("objective_functions." + self.
                        objective)(self, subset, **kwargs)
        elif hasattr(early_detection, self.objective):
            return eval("early_detection." + self.
                        objective)(self, subset, **kwargs)
        else:
            print(self.objective + " is not an objective function")
            sys.exit()
Ejemplo n.º 2
0
    def graph_data_sources(self, sources):
        r"""Plots the data sources from sources and prints a legend

        Parameters
        ----------
        sources : list
            subset of data dictionaries from data

        """
        sources = dm.listify(sources)
        for source in sources:
            source = dm.normalize(source)
            time = source['data']['times']
            values = source['data']['values']
            name = source['metadata']['name']
            subname = source['metadata']['subname']
            plt.plot(time, values, label = name + " | " + subname)
        plt.legend(loc=2, prop={'size': 10})
        plt.show()
Ejemplo n.º 3
0
    def test_OOS(self, subset, **kwargs):
        r"""Evaluates objective function on specified subset. Returns distance
        between self.goal and the series in subset

        Notes
        -----
        

        Parameters
        ----------
        subset : list
            subset of data dictionaries from data

        Returns
        -------
        return : float
            a measure of distance

        """
        subset = dm.listify(subset)
        return objective_functions.R_squared_OOS(self, subset, **kwargs)