Esempio n. 1
0
    def test_dimension_deletion_backward_already_existing(self, trials):
        """Test :meth:`orion.core.evc.adapters.DimensionDeletion.backward`
        with valid param and invalid trials because param already exist
        """
        new_param = Trial.Param(name="normal_prior", type="integer", value=1)
        dimension_deletion_adapter = DimensionDeletion(new_param)

        with pytest.raises(RuntimeError) as exc_info:
            dimension_deletion_adapter.backward(trials)
        assert "Provided trial does not have a compatible configuration" in str(
            exc_info.value)
Esempio n. 2
0
    def test_dimension_deletion_backward(self, dummy_param, trials):
        """Test :meth:`orion.core.evc.adapters.DimensionDeletion.backward`
        with valid param and valid trials
        """
        new_param = Trial.Param(name="second_normal_prior",
                                type="integer",
                                value=1)
        dimension_deletion_adapter = DimensionDeletion(new_param)

        adapted_trials = dimension_deletion_adapter.backward(trials)

        assert adapted_trials[0]._params[-1] == new_param
        assert adapted_trials[4]._params[-1] == new_param
        assert adapted_trials[-1]._params[-1] == new_param