def setUp(self):
        np.random.seed(2)
        n_points = 100
        normal_noise = np.random.normal(0, 1.0, n_points)
        points = np.linspace(0, 10, n_points)
        points = points.reshape([n_points, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([2.0]))
        self.sigma2 = ParameterEntity(SIGMA2_NAME, np.array([1.0]), None)
        kernel = ScaledKernel(1, kernel, self.sigma2)

        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]
        evaluations = function + normal_noise + 10.0
        self.training_data_gp = {
            "evaluations": list(evaluations),
            "points": points,
            "var_noise": []
        }
        bounds = None
        self.gp_gaussian = GPFittingGaussian([MATERN52_NAME],
                                             self.training_data_gp, [1],
                                             bounds,
                                             max_steps_out=1000)

        self.gp_gaussian_2 = GPFittingGaussian([SCALED_KERNEL, MATERN52_NAME],
                                               self.training_data_gp, [1],
                                               bounds,
                                               max_steps_out=1000)
    def test_cross_validation_mle_parameters(self):
        type_kernel = [MATERN52_NAME]

        np.random.seed(5)
        n_points = 10
        normal_noise = np.random.normal(0, 0.01, n_points)
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])

        kernel = Matern52.define_kernel_from_array(1, np.array([100.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]
        evaluations = function + normal_noise

        training_data = {
            "evaluations": evaluations,
            "points": points,
            "var_noise": None}

        dimensions = [1]
        problem_name = 'a'

        result = \
            ValidationGPModel.cross_validation_mle_parameters(type_kernel, training_data,
                                                              dimensions, problem_name,
                                                              start=np.array([0.01**2, 0.0, 100.0]))

        compare = 'results/diagnostic_kernel/a/validation_kernel_histogram_a_' + MATERN52_NAME + \
                  '_same_correlation_False_10_None.png'
        assert result['filename_histogram'] == compare
        assert np.all(result['y_eval'] == evaluations)
        assert result['n_data'] == n_points
        assert result['filename_plot'] == 'results/diagnostic_kernel/a/' \
                                          'validation_kernel_mean_vs_observations_a_' + \
                                          MATERN52_NAME + '_same_correlation_False_10_None' + '.png'
        assert result['success_proportion'] >= 0.9

        noise = np.random.normal(0, 0.000001, n_points)
        evaluations_noisy = evaluations + noise

        training_data_2 = {
            "evaluations": evaluations_noisy,
            "points": points,
            "var_noise": np.array(n_points * [0.000001**2])}

        result_2 = \
            ValidationGPModel.cross_validation_mle_parameters(type_kernel, training_data_2,
                                                              dimensions, problem_name,
                                                              start=np.array([0.01**2, 0.0, 100.0]))

        compare = 'results/diagnostic_kernel/a/validation_kernel_histogram_a_' + MATERN52_NAME + \
                  '_same_correlation_False_10_None.png'
        assert result_2['filename_histogram'] == compare
        assert np.all(result_2['y_eval'] == evaluations_noisy)
        assert result_2['n_data'] == n_points

        compare = 'results/diagnostic_kernel/a/validation_kernel_mean_vs_observations_a_' + \
                  MATERN52_NAME + '_same_correlation_False_10_None.png'
        assert result_2['filename_plot'] == compare
        assert result_2['success_proportion'] >= 0.9
Пример #3
0
    def setUp(self):
        np.random.seed(5)
        n_points = 100
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])
        tasks = np.random.randint(2, size=(n_points, 1))

        add = [-10, 10]
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        self.function = function

        for i in xrange(n_points):
            function[0, i] += add[tasks[i, 0]]
        points = np.concatenate((points, tasks), axis=1)
        self.points = points
        self.evaluations = function[0, :]

        function = function[0, :]

        training_data = {
            'evaluations': list(function),
            'points': points,
            "var_noise": [],
        }
        gaussian_p = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data, [2, 1, 2], bounds_domain=[[0, 100], [0, 1]], type_bounds=[0, 1])
        gaussian_p = gaussian_p.fit_gp_regression(random_seed=1314938)

        quadrature = BayesianQuadrature(gaussian_p, [0], UNIFORM_FINITE,
                                        parameters_distribution={TASKS: 2},
                                        model_only_x=True)
        self.mt = MultiTasks(quadrature, quadrature.parameters_distribution.get(TASKS))
    def test_cross_validation_mle_parameters_2(self):
        type_kernel = [MATERN52_NAME]

        np.random.seed(5)
        n_points = 10
        normal_noise = np.random.normal(0, 0.01, n_points)
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])

        kernel = Matern52.define_kernel_from_array(1, np.array([100.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]
        evaluations = function + normal_noise

        training_data = {
            "evaluations": evaluations,
            "points": points,
            "var_noise": None}

        dimensions = [1]
        problem_name = 'a'

        result = \
            ValidationGPModel.cross_validation_mle_parameters(type_kernel, training_data,
                                                              dimensions, problem_name,
                                                              start=np.array([-1]))
        assert result['success_proportion'] == -1
    def test_sample_new_observations(self):
        np.random.seed(5)
        n_points = 10
        normal_noise = np.random.normal(0, 0.5, n_points)
        points = np.linspace(0, 500, n_points)
        points = points.reshape([n_points, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]
        evaluations = function + normal_noise

        training_data_gp = {
            "evaluations": list(evaluations[1:]),
            "points": points[1:, :],
            "var_noise": []}
        gp = GPFittingGaussian([MATERN52_NAME], training_data_gp, [1], kernel_values=[100.0, 1.0],
                               mean_value=[0.0], var_noise_value=[0.5**2])

        n_samples = 100
        samples = gp.sample_new_observations(np.array([[30.0]]), n_samples, random_seed=1)

        new_point = np.array([[30.0]])
        z = gp.compute_posterior_parameters(new_point)
        mean = z['mean']
        cov = z['cov']

        npt.assert_almost_equal(mean, np.mean(samples), decimal=1)
        npt.assert_almost_equal(cov, np.var(samples), decimal=1)
    def test_compute_posterior_parameters(self):
        np.random.seed(5)
        n_points = 10
        normal_noise = np.random.normal(0, 0.5, n_points)
        points = np.linspace(0, 500, n_points)
        points = points.reshape([n_points, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]
        evaluations = function + normal_noise

        training_data_gp = {
            "evaluations": list(evaluations[1:]),
            "points": points[1:, :],
            "var_noise": []}
        gp = GPFittingGaussian([MATERN52_NAME], training_data_gp, [1], kernel_values=[100.0, 1.0],
                               mean_value=[0.0], var_noise_value=[0.5**2])

        new_point = np.array([points[0], points[1]])
        z = gp.compute_posterior_parameters(new_point)
        mean = z['mean']
        cov = z['cov']

        assert mean[1] - 2.0 * np.sqrt(cov[1, 1]) <= function[1]
        assert function[1] <= mean[1] + 2.0 * np.sqrt(cov[1, 1])
        assert mean[0] - 2.0 * np.sqrt(cov[0, 0]) <= function[0]
        assert function[0] <= mean[0] + 2.0 * np.sqrt(cov[0, 0])

        # Values obtained from GPy
        npt.assert_almost_equal(mean, np.array([0.30891226, 0.60256237]))
        npt.assert_almost_equal(cov, np.array([[0.48844879, 0.16799927], [0.16799927, 0.16536313]]))
    def test_train(self):
        np.random.seed(5)
        n_points = 10
        normal_noise = np.random.normal(0, 0.5, n_points)
        points = np.linspace(0, 500, n_points)
        points = points.reshape([n_points, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]

        evaluations = function + normal_noise

        training_data_gp = {
            "evaluations": list(evaluations),
            "points": points,
            "var_noise": []}
        new_gp = GPFittingGaussian.train([MATERN52_NAME], [1], True, training_data_gp, None,
                                         random_seed=1314938)

        gp_gaussian = GPFittingGaussian([MATERN52_NAME], training_data_gp, [1])
        gp_2 = gp_gaussian.fit_gp_regression(random_seed=1314938)

        npt.assert_almost_equal(new_gp.var_noise.value[0], gp_2.var_noise.value[0], decimal=6)
        npt.assert_almost_equal(new_gp.mean.value[0], gp_2.mean.value[0], decimal=6)
        npt.assert_almost_equal(new_gp.kernel_values, gp_2.kernel_values)

        gp_gaussian = GPFittingGaussian([MATERN52_NAME], training_data_gp, [1])
        new_gp_2 = GPFittingGaussian.train([MATERN52_NAME], [1], False, training_data_gp, None)

        npt.assert_almost_equal(new_gp_2.var_noise.value[0], gp_gaussian.var_noise.value[0])
        npt.assert_almost_equal(new_gp_2.mean.value[0], gp_gaussian.mean.value[0], decimal=6)
        npt.assert_almost_equal(new_gp_2.kernel_values, gp_gaussian.kernel_values)
    def test_sample_from_gp(self):
        x = np.linspace(0, 10, 50)
        x = x.reshape([50, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([3.0, 5.0]))
        function = SampleFunctions.sample_from_gp(x, kernel, n_samples=100000)

        mean = np.mean(function, axis=0)
        cov = np.cov(function.transpose())
        cov_ = kernel.cov(x)

        npt.assert_almost_equal(mean, np.zeros(len(mean)), decimal=1)
        npt.assert_almost_equal(cov, cov_, decimal=1)

        function_2 = SampleFunctions.sample_from_gp(x,
                                                    kernel,
                                                    n_samples=100000,
                                                    random_seed=10)
        mean = np.mean(function_2, axis=0)
        cov = np.cov(function_2.transpose())
        cov_ = kernel.cov(x)

        npt.assert_almost_equal(mean, np.zeros(len(mean)), decimal=1)
        npt.assert_almost_equal(cov, cov_, decimal=1)
Пример #9
0
    def test_optimize_posterior_mean_samples(self):
        np.random.seed(5)
        n_points = 100
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])
        tasks = np.random.randint(2, size=(n_points, 1))

        add = [10, -10]
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        max_value = function[0, np.argmax(function)]
        max_point = points[np.argmax(function), 0]

        for i in xrange(n_points):
            function[0, i] += add[tasks[i, 0]]
        points = np.concatenate((points, tasks), axis=1)

        function = function[0, :]

        training_data = {
            'evaluations': list(function),
            'points': points,
            "var_noise": [],
        }

        gaussian_p = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data, [2, 1, 2],
            bounds_domain=[[0, 100]],
            max_steps_out=1000)
        gaussian_p = gaussian_p.fit_gp_regression(random_seed=1314938)
        gp = BayesianQuadrature(gaussian_p, [0], UNIFORM_FINITE, {TASKS: 2})

        random_seed = 10

        n_samples_parameters = 15
        gp.gp.thinning = 10
        gp.gp.n_burning = 500

        sol_2 = gp.optimize_posterior_mean(
            random_seed=random_seed,
            n_best_restarts=2,
            n_samples_parameters=n_samples_parameters,
            start_new_chain=True)

        assert max_point == sol_2['solution']
        npt.assert_almost_equal(max_value, sol_2['optimal_value'], decimal=3)
Пример #10
0
    def test_gradient_vector_b(self):
        np.random.seed(5)
        n_points = 10
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])
        tasks = np.random.randint(2, size=(n_points, 1))

        add = [10, -10]
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)

        for i in xrange(n_points):
            function[0, i] += add[tasks[i, 0]]
        points = np.concatenate((points, tasks), axis=1)

        function = function[0, :]

        training_data = {
            'evaluations': list(function),
            'points': points,
            "var_noise": [],
        }

        gaussian_p = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data, [2, 1, 2],
            bounds_domain=[[0, 100]])
        gaussian_p = gaussian_p.fit_gp_regression(random_seed=1314938)

        gp = BayesianQuadrature(gaussian_p, [0], UNIFORM_FINITE, {TASKS: 2})
        #  gp = self.gp_complete
        candidate_point = np.array([[84.0, 1]])
        points = np.array([[99.5], [12.1], [70.2]])
        value = gp.gradient_vector_b(candidate_point, points, cache=False)

        dh_ = 0.0000001
        dh = [dh_]
        finite_diff = FiniteDifferences.forward_difference(
            lambda point: gp.compute_posterior_parameters_kg(
                points, point.reshape((1, len(point))), cache=False)['b'],
            candidate_point[0, :], np.array(dh))
        npt.assert_almost_equal(finite_diff[0], value[:, 0], decimal=5)
        assert np.all(finite_diff[1] == value[:, 1])

        value_2 = gp.gradient_vector_b(candidate_point, points, cache=True)
        assert np.all(value_2 == value)
    def test_mle_parameters(self):
        # Results compared with the ones given by GPy

        np.random.seed(1)
        add = -45.946926660233636

        llh = self.gp_gaussian.log_likelihood(1.0, 0.0, np.array([100.0, 1.0]))
        npt.assert_almost_equal(llh + add, -59.8285565516, decimal=6)

        opt = self.gp_gaussian.mle_parameters(start=np.array([1.0, 0.0, 14.0, 0.9]))

        assert opt['optimal_value'] + add >= -67.1494227694

        compare = self.gp_gaussian.log_likelihood(9, 10.0, np.array([100.2, 1.1]))
        assert self.gp_gaussian_central.log_likelihood(9, 0.0, np.array([100.2, 1.1])) == compare

        np.random.seed(5)
        n_points = 10
        normal_noise = np.random.normal(0, 0.5, n_points)
        points = np.linspace(0, 500, n_points)
        points = points.reshape([n_points, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]

        evaluations = function + normal_noise

        training_data_gp = {
            "evaluations": list(evaluations),
            "points": points,
            "var_noise": []}

        gp_gaussian = GPFittingGaussian([MATERN52_NAME], training_data_gp, [1])

        opt_3 = gp_gaussian.mle_parameters(random_seed=1314938)
        np.random.seed(1314938)
        start = gp_gaussian.sample_parameters_posterior(1)[0, :]
        opt_4 = gp_gaussian.mle_parameters(start)

        npt.assert_almost_equal(opt_3['optimal_value'], opt_4['optimal_value'])
        npt.assert_almost_equal(opt_3['solution'], opt_4['solution'], decimal=4)
Пример #12
0
    def setUp(self):

        self.bounds_domain_x = BoundsEntity({
            'lower_bound': 0,
            'upper_bound': 100,
        })

        spec_domain = {
            'dim_x': 1,
            'choose_noise': True,
            'bounds_domain_x': [self.bounds_domain_x],
            'number_points_each_dimension': [100],
            'problem_name': 'a',
        }

        self.domain = DomainService.from_dict(spec_domain)

        dict = {
            'problem_name':
            'test_problem_with_tasks',
            'dim_x':
            1,
            'choose_noise':
            True,
            'bounds_domain_x':
            [BoundsEntity({
                'lower_bound': 0,
                'upper_bound': 100
            })],
            'number_points_each_dimension': [100],
            'method_optimization':
            'sbo',
            'training_name':
            'test_bgo',
            'bounds_domain': [[0, 100], [0, 1]],
            'n_training':
            4,
            'type_kernel':
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            'noise':
            False,
            'random_seed':
            5,
            'parallel':
            False,
            'type_bounds': [0, 1],
            'dimensions': [2, 1, 2],
            'name_model':
            'gp_fitting_gaussian',
            'mle':
            True,
            'thinning':
            0,
            'n_burning':
            0,
            'max_steps_out':
            1,
            'training_data':
            None,
            'x_domain': [0],
            'distribution':
            UNIFORM_FINITE,
            'parameters_distribution':
            None,
            'minimize':
            False,
            'n_iterations':
            5,
        }

        self.spec = RunSpecEntity(dict)

        self.acquisition_function = None
        self.gp_model = None

        ###Define other BGO object
        np.random.seed(5)
        n_points = 100
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])
        tasks = np.random.randint(2, size=(n_points, 1))

        add = [10, -10]
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)

        for i in xrange(n_points):
            function[0, i] += add[tasks[i, 0]]
        points = np.concatenate((points, tasks), axis=1)
        self.points = points

        function = function[0, :]

        points_ls = [list(points[i, :]) for i in xrange(n_points)]

        training_data_med = {
            'evaluations': list(function[0:5]),
            'points': points_ls[0:5],
            "var_noise": [],
        }

        self.training_data = training_data_med

        training_data = {
            'evaluations': list(function),
            'points': points,
            "var_noise": [],
        }

        gaussian_p = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data, [2, 1, 2],
            bounds_domain=[[0, 100], [0, 1]],
            type_bounds=[0, 1])
        gaussian_p = gaussian_p.fit_gp_regression(random_seed=1314938)

        params = gaussian_p.get_value_parameters_model
        self.params = params

        dict = {
            'problem_name':
            'test_simulated_gp',
            'dim_x':
            1,
            'choose_noise':
            True,
            'bounds_domain_x':
            [BoundsEntity({
                'lower_bound': 0,
                'upper_bound': 100
            })],
            'number_points_each_dimension': [100],
            'method_optimization':
            'sbo',
            'training_name':
            'test_sbo',
            'bounds_domain': [[0, 100], [0, 1]],
            'n_training':
            5,
            'type_kernel':
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            'noise':
            False,
            'random_seed':
            5,
            'parallel':
            False,
            'type_bounds': [0, 1],
            'dimensions': [2, 1, 2],
            'name_model':
            'gp_fitting_gaussian',
            'mle':
            False,
            'thinning':
            0,
            'n_burning':
            0,
            'max_steps_out':
            1,
            'training_data':
            training_data_med,
            'x_domain': [0],
            'distribution':
            UNIFORM_FINITE,
            'parameters_distribution':
            None,
            'minimize':
            False,
            'n_iterations':
            1,
            'var_noise_value': [params[0]],
            'mean_value': [params[1]],
            'kernel_values':
            list(params[2:]),
            'cache':
            False,
            'debug':
            False,
        }

        self.spec_2 = RunSpecEntity(dict)
Пример #13
0
    def setUp(self):
        self.training_data_complex = {
            "evaluations": [1.0, 1.1],
            "points": [[42.2851784656, 0], [42.3851784656, 0]],
            "var_noise": []
        }

        self.complex_gp = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            self.training_data_complex, [2, 1, 1])

        self.gp = BayesianQuadrature(self.complex_gp, [0], UNIFORM_FINITE,
                                     {TASKS: 1})

        training_data_complex = {
            "evaluations": [1.0, 1.1],
            "points": [[42.2851784656, 0], [42.3851784656, 1]],
            "var_noise": []
        }

        self.complex_gp_2 = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data_complex, [3, 1, 2])

        self.gp_2 = BayesianQuadrature(self.complex_gp_2, [0], UNIFORM_FINITE,
                                       {TASKS: 2})

        np.random.seed(5)
        n_points = 100
        points = np.linspace(0, 100, n_points)
        points = points.reshape([n_points, 1])
        tasks = np.random.randint(2, size=(n_points, 1))

        add = [10, -10]
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        self.original_function = function

        self.max_value = function[0, np.argmax(function)]
        self.max_point = points[np.argmax(function), 0]
        for i in xrange(n_points):
            function[0, i] += add[tasks[i, 0]]
        points = np.concatenate((points, tasks), axis=1)

        function = function[0, :]

        training_data = {
            'evaluations': list(function),
            'points': points,
            "var_noise": [],
        }

        training_data_2 = {
            'evaluations': list(function[[0, 30, 50, 90, 99]]),
            'points': points[[0, 30, 50, 90, 99], :],
            "var_noise": [],
        }

        gaussian_p = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data, [2, 1, 2],
            bounds_domain=[[0, 100]])
        gaussian_p = gaussian_p.fit_gp_regression(random_seed=1314938)

        gaussian_p_2 = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            training_data_2, [2, 1, 2],
            bounds_domain=[[0, 100]])
        gaussian_p_2 = gaussian_p.fit_gp_regression(random_seed=1314938)

        self.gp_complete_2 = BayesianQuadrature(gaussian_p_2, [0],
                                                UNIFORM_FINITE, {TASKS: 2})
        self.gp_complete = BayesianQuadrature(gaussian_p, [0], UNIFORM_FINITE,
                                              {TASKS: 2})
Пример #14
0
from stratified_bayesian_optimization.kernels.matern52 import Matern52
from stratified_bayesian_optimization.lib.sample_functions import SampleFunctions

decimals = 10
random_seed = 5
np.random.seed(random_seed)
n_points = 1000
points = np.linspace(0, 100, n_points)
points = np.round(points, decimals=decimals)
points = points.reshape([n_points, 1])

tasks = np.array([[0, 1]])

add = [10, -10]
kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
function = SampleFunctions.sample_from_gp(points, kernel)
function = function[0, :]

final_function = {}

for task in range(2):
    final_function[task] = []
    for i in xrange(n_points):
        point = np.concatenate((points[i, :], np.array([task])))
        final_function[task].append(function[i] + add[task])

filename = path.join('problems', 'test_simulated_gp',
                     'simulated_function_with_%d_%d' % (n_points, random_seed))

JSONFile.write({'function': final_function, 'points': points}, filename)
    def setUp(self):
        type_kernel = [SCALED_KERNEL, MATERN52_NAME]
        self.training_data = {
            "evaluations":
                [42.2851784656, 72.3121248508, 1.0113231069, 30.9309246906, 15.5288331909],
            "points": [
                [42.2851784656], [72.3121248508], [1.0113231069], [30.9309246906], [15.5288331909]],
            "var_noise": []}
        dimensions = [1]

        self.gp = GPFittingGaussian(type_kernel, self.training_data, dimensions,
                                    bounds_domain=[[0, 100]])

        self.training_data_3 = {
            "evaluations": [42.2851784656, 72.3121248508, 1.0113231069, 30.9309246906,
                            15.5288331909],
            "points": [
                [42.2851784656], [72.3121248508], [1.0113231069], [30.9309246906], [15.5288331909]],
            "var_noise": [0.5, 0.8, 0.7, 0.9, 1.0]}

        self.gp_3 = GPFittingGaussian(type_kernel, self.training_data_3, dimensions,
                                      bounds_domain=[[0, 100]])
        self.training_data_simple = {
            "evaluations": [5],
            "points": [[5]],
            "var_noise": []}
        dimensions = [1]

        self.simple_gp = GPFittingGaussian(type_kernel, self.training_data_simple, dimensions,
                                           bounds_domain=[[0, 100]])

        self.training_data_complex = {
            "evaluations": [1.0],
            "points": [[42.2851784656, 0]],
            "var_noise": [0.5]}

        self.complex_gp = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            self.training_data_complex, [2, 1, 1], bounds_domain=[[0, 100], [0]])

        self.training_data_complex_2 = {
            "evaluations": [1.0, 2.0, 3.0],
            "points": [[42.2851784656, 0], [10.532, 0], [9.123123, 1]],
            "var_noise": [0.5, 0.2, 0.1]}

        self.complex_gp_2 = GPFittingGaussian(
            [PRODUCT_KERNELS_SEPARABLE, MATERN52_NAME, TASKS_KERNEL_NAME],
            self.training_data_complex_2, [3, 1, 2], bounds_domain=[[0, 100], [0, 1]])

        self.new_point = np.array([[80.0]])
        self.evaluation = np.array([80.0])

        self.training_data_noisy = {
            "evaluations": [41.0101845096],
            "points": [[42.2851784656]],
            "var_noise": [0.0181073779]}

        self.gp_noisy = GPFittingGaussian(type_kernel, self.training_data_noisy, dimensions,
                                          bounds_domain=[[0, 100]])

        np.random.seed(2)
        n_points = 50
        normal_noise = np.random.normal(0, 0.5, n_points)
        points = np.linspace(0, 500, n_points)
        points = points.reshape([n_points, 1])
        kernel = Matern52.define_kernel_from_array(1, np.array([100.0, 1.0]))
        function = SampleFunctions.sample_from_gp(points, kernel)
        function = function[0, :]

        evaluations = function + normal_noise

        self.training_data_gp = {
            "evaluations": list(evaluations),
            "points": points,
            "var_noise": []}

        self.gp_gaussian = GPFittingGaussian([SCALED_KERNEL, MATERN52_NAME], self.training_data_gp,
                                             [1])

        self.gp_gaussian_2 = GPFittingGaussian([MATERN52_NAME], self.training_data_gp, [1],
                                               bounds_domain=[[0, 100]])

        self.training_data_gp_2 = {
            "evaluations": list(evaluations - 10.0),
            "points": points,
            "var_noise": []}
        self.gp_gaussian_central = GPFittingGaussian([SCALED_KERNEL, MATERN52_NAME],
                                                     self.training_data_gp_2, [1],
                                                     bounds_domain=[[0, 100]])