def test_reset_y_star_event(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 1, 1]])
     ei.current = [
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=1, sigma=1)
     ]
     ei.execute()
     ei.target = array([[2, 2, 2]])
     ei.execute()
     self.assertEqual(ei.y_star.all(), array([2, 2, 2]).all())
 def test_reset_y_star_event(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 1, 1]])
     ei.current = [NormalDistribution(mu=1,sigma=1),
                   NormalDistribution(mu=1,sigma=1),
                   NormalDistribution(mu=1,sigma=1)]
     ei.execute()
     ei.target = array([[2, 2, 2]])
     ei.execute()
     self.assertEqual(ei.y_star.all(), array([2, 2, 2]).all())
 def test_ei_2obj(self):
     ei = MultiObjExpectedImprovement()
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1",1),("y2",10)]),Case(outputs=[("y1",1),("y2",-10)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests
     ei.criteria = ["y1","y2"]
     ei.predicted_values = [NormalDistribution(mu=1,sigma=1),NormalDistribution(mu=0,sigma=1)]
     ei.calc_switch = "EI"
     ei.execute()
     self.assertAlmostEqual([5.0],ei.EI,1)
     self.assertEqual(0.5,ei.PI,6)
 def test_ei_2obj(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 10], [1, -10]])
     ei.current = [
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=0, sigma=1)
     ]
     ei.calc_switch = "EI"
     ei.execute()
     self.assertAlmostEqual([5.0], ei.EI, 1)
     self.assertEqual(0.5, ei.PI, 6)
 def test_ei_nobj(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 1, 1]])
     list_of_cases = [Case(outputs=[("y1", 1), ("y2", 1), ("y3", 1)])]
     ei.criteria = ['y1', 'y2', 'y3']
     ei.current = [
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=1, sigma=1)
     ]
     ei.execute()
     self.assertAlmostEqual(0.875, ei.PI, 1)
 def test_ei_2obj(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 10], [1, -10]])
     ei.current = [NormalDistribution(mu=1, sigma=1),
                   NormalDistribution(mu=0, sigma=1)]
     ei.calc_switch = "EI"
     ei.execute()
     self.assertAlmostEqual([5.0], ei.EI,1)
     self.assertEqual(0.5, ei.PI,6)
Ejemplo n.º 7
0
 def test_ei_nobj(self):
     ei = MultiObjExpectedImprovement(3)
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1",1),("y2",1),("y3",1)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests
     ei.criteria = ['y1','y2','y3']
     ei.predicted_values = [NormalDistribution(mu=1,sigma=1),
                            NormalDistribution(mu=1,sigma=1),
                            NormalDistribution(mu=1,sigma=1)]
     ei.execute()
     self.assertAlmostEqual(0.875,ei.PI,1)
 def test_ei_2obj(self):
     ei = MultiObjExpectedImprovement()
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1", 1), ("y2", 10)]), Case(outputs=[("y1", 1), ("y2", -10)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests
     ei.criteria = ["y1", "y2"]
     ei.predicted_values = [NormalDistribution(mu=1, sigma=1), NormalDistribution(mu=0, sigma=1)]
     ei.calc_switch = "EI"
     ei.execute()
     self.assertAlmostEqual([5.0], ei.EI, 1)
     self.assertEqual(0.5, ei.PI, 6)
Ejemplo n.º 9
0
 def test_ei_calc_switch(self):
     ei = MultiObjExpectedImprovement(3)
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1",1),("y2",1),("y3",1)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests
     ei.criteria = ['y1','y2','y3']
     ei.predicted_values = [NormalDistribution(mu=1,sigma=1),
                            NormalDistribution(mu=1,sigma=1),
                            NormalDistribution(mu=1,sigma=1)]
     ei.calc_switch = 'EI'
     try:
         ei.execute()
     except ValueError,err:
         self.assertEqual(str(err),': EI calculations not supported'
                                         ' for more than 2 objectives')
 def test_ei_nobj(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 1, 1]])
     list_of_cases = [Case(outputs=[("y1", 1), ("y2", 1), ("y3", 1)])]
     ei.criteria = ['y1', 'y2', 'y3']
     ei.current = [NormalDistribution(mu=1, sigma=1),
                   NormalDistribution(mu=1, sigma=1),
                   NormalDistribution(mu=1, sigma=1)]
     ei.execute()
     self.assertAlmostEqual(0.875,ei.PI,1)
Ejemplo n.º 11
0
 def test_bad_criteria(self):
     ei = MultiObjExpectedImprovement(2)
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1",1),("y2",1)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests
     ei.criteria = ['y1','y3']
     ei.predicted_values = [NormalDistribution(mu=1,sigma=1),
                                                 NormalDistribution(mu=1,sigma=1)]
     try:
         ei.execute()
     except ValueError,err:
         self.assertEqual(str(err),": no cases in the provided case_set"
                             " had output matching the provided criteria, ['y1' 'y3']")
 def test_ei_calc_switch(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 1, 1]])
     ei.current = [
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=1, sigma=1),
         NormalDistribution(mu=1, sigma=1)
     ]
     ei.calc_switch = 'EI'
     try:
         ei.execute()
     except ValueError, err:
         self.assertEqual(
             str(err), ': EI calculations not supported'
             ' for more than 2 objectives')
 def test_ei_calc_switch(self):
     ei = MultiObjExpectedImprovement()
     ei.target = array([[1, 1, 1]])
     ei.current = [NormalDistribution(mu=1, sigma=1),
                   NormalDistribution(mu=1, sigma=1),
                   NormalDistribution(mu=1, sigma=1)]
     ei.calc_switch = 'EI'
     try:
         ei.execute()
     except ValueError,err:
         self.assertEqual(str(err),': EI calculations not supported'
                          ' for more than 2 objectives')
Ejemplo n.º 14
0
 def test_reset_y_star_event(self):
     ei = MultiObjExpectedImprovement(3)
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1",1),("y2",1),("y3",1)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests
     ei.criteria = ['y1','y2','y3']
     ei.predicted_values = [NormalDistribution(mu=1,sigma=1),
                                                 NormalDistribution(mu=1,sigma=1),
                                                 NormalDistribution(mu=1,sigma=1)]
     ei.execute()
     bests = CaseSet()
     list_of_cases = [Case(outputs=[("y1",2),("y2",2),("y3",2)])]
     for case in list_of_cases:
         bests.record(case)
     ei.best_cases = bests        
     ei.reset_y_star = True
     ei.execute()
     self.assertEqual(ei.y_star.all(),array([2,2,2]).all())