Esempio n. 1
0
    def plot_optCurve_nEvals(self, plot_best=True, scale='log', type='mean+65'):
        """
        assume that the experiment have the same lenght
        :return: 
        """
        data = []
        for idx, experiment in enumerate(self.experiments):
            max_lenght = 0
            for rep in np.arange(experiment.repetitions):
                max_lenght = max(max_lenght, self._logs.logs[idx, rep].get_n_evals())
            temp = np.nan * np.empty((experiment.repetitions, max_lenght))  # initialize matrix
            for rep in np.arange(experiment.repetitions):
                if plot_best:
                    temp[rep, 0:self._logs.logs[idx, rep].get_n_evals()] = bestof(np.matrix(self._logs.logs[idx, rep].get_objectives()).T).T
                else:
                    temp[rep, 0:self._logs.logs[idx, rep].get_n_evals()] = self._logs.logs[idx, rep].get_objectives()
            data.append(temp)

        #
        plt.figure()
        spp.rplot_data(data, legend=self.get_labels(), typeplot=type)
        plt.xlabel('Evaluations')
        plt.ylabel('Obj.Func.')
        if scale == 'log':
            try:
                ax = plt.gca()
                ax.set_yscale('log')
            except:
                print('log scale is not possible')
Esempio n. 2
0
 def test_rplot_data_yscale(self):
     y = [np.absolute(np.random.rand(100, 100)) + 0.00001]
     x = np.random.rand(100)
     h = spp.rplot_data(data=y)
     plt.yscale('log')
Esempio n. 3
0
 def test_rplot_data_matrix(self):
     y = np.random.rand(100, 100)
     h = spp.rplot_data(data=y)
Esempio n. 4
0
 def test_rplot_data_3(self):
     y = [np.random.rand(100, 100)]
     x = np.random.rand(100)
     h = spp.rplot_data(data=y)