コード例 #1
0
 def test_example(self):
     method = SelectObjective(fill_in_strategy='random',
                              f=self.f,
                              domain=self.domain)
     method.run_optimization(max_iter=10)
     self.assertEqual(method.num_acquisitions, 10)
     self.assertEqual(len(method.bernoulli_theta), 4)
     self.assertTrue(True)
コード例 #2
0
          {'name': 'x42', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x43', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x44', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x45', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x46', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x47', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x48', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          {'name': 'x49', 'type': 'continuous', 'domain': (1, 4), 'dimensionality': 1},
          ]


for i in range(4):

    dim = len(domain)
    fill_in_strategy = 'random'
    f = GaussianMixtureFunction(dim=dim, mean_1=2, mean_2=3)
    method = SelectObjective(f=f, domain=domain, fill_in_strategy=fill_in_strategy, maximize=True)
    method.run_optimization(max_iter=500, eps=0)

    dim = len(domain)
    fill_in_strategy = 'copy'
    f = GaussianMixtureFunction(dim=dim, mean_1=2, mean_2=3)
    method = SelectObjective(f=f, domain=domain, fill_in_strategy=fill_in_strategy, maximize=True)
    method.run_optimization(max_iter=500, eps=0)

    dim = len(domain)
    fill_in_strategy = 'mix'
    f = GaussianMixtureFunction(dim=dim, mean_1=2, mean_2=3)
    method = SelectObjective(f=f, domain=domain, fill_in_strategy=fill_in_strategy, maximize=True, mix=0.5)
    method.run_optimization(max_iter=500, eps=0)
コード例 #3
0
        'dimensionality': 1
    },
    {
        'name': 'x2',
        'type': 'continuous',
        'domain': (1, 4),
        'dimensionality': 1
    },
    {
        'name': 'x3',
        'type': 'continuous',
        'domain': (1, 4),
        'dimensionality': 1
    },
    {
        'name': 'x4',
        'type': 'continuous',
        'domain': (1, 4),
        'dimensionality': 1
    },
]

dim = len(domain)
f = GaussianMixtureFunction(dim=dim, mean_1=2, mean_2=3)

method = SelectObjective(fill_in_strategy='random',
                         f=f,
                         domain=domain,
                         maximize=True)
method.run_optimization(max_iter=100)