コード例 #1
0
    def test_format_objective(self):
        objective = utils.format_objective(
            oracle_module.Objective(name="val_acc", direction="max"))
        self.assertEqual(
            objective,
            [oracle_module.Objective(name="val_acc", direction="max")])

        objective = utils.format_objective("accuracy")
        self.assertEqual(
            objective,
            [oracle_module.Objective(name="accuracy", direction="max")])

        objective = utils.format_objective(["val_acc", "val_loss"])
        self.assertEqual(
            objective,
            [
                oracle_module.Objective(name="val_acc", direction="max"),
                oracle_module.Objective(name="val_loss", direction="min"),
            ],
        )
コード例 #2
0
 def test_format_objective(self, objective, direction, expected_oracle_obj):
     formatted_objective = utils.format_objective(objective, direction)
     self.assertEqual(formatted_objective, expected_oracle_obj)