Exemple #1
0
    def test_dimension_prior_change_forward_incompatible_dimensions(
            self, small_prior, disjoint_prior, trials):
        """Test :meth:`orion.core.evc.adapters.DimensionPriorChange.forward`
        with incompatible priors, such that all trials are filtered out
        """
        dimension_prior_change_adapter = DimensionPriorChange(
            "small_prior", small_prior, disjoint_prior)

        adapted_trials = dimension_prior_change_adapter.forward(trials)

        assert len(adapted_trials) == 0
Exemple #2
0
    def test_dimension_prior_change_forward(self, large_prior, small_prior,
                                            trials):
        """Test :meth:`orion.core.evc.adapters.DimensionPriorChange.forward`
        with compatible priors
        """
        dimension_prior_change_adapter = DimensionPriorChange(
            "small_prior", small_prior, large_prior)

        adapted_trials = dimension_prior_change_adapter.forward(trials)

        assert len(adapted_trials) == len(trials)
Exemple #3
0
    def test_dimension_prior_change_forward_different_shapes(
            self, small_prior, prior_with_shape, trials, caplog):
        """Test :meth:`orion.core.evc.adapters.DimensionPriorChange.forward`
        with priors of different shapes
        """
        with caplog.at_level(logging.WARNING):
            dimension_prior_change_adapter = DimensionPriorChange(
                "small_prior", small_prior, prior_with_shape)

        assert ("Oríon does not support yet adaptations on prior shape changes"
                in caplog.records[0].msg)

        trials = generate_trials({"small_prior": small_prior}, 10)

        adapted_trials = dimension_prior_change_adapter.forward(trials)

        assert len(adapted_trials) == 0