def test_batch_monte_carlo_expected_improvement_raises_for_model_with_wrong_event_shape( ) -> None: builder = BatchMonteCarloExpectedImprovement(100) data = mk_dataset([[0.0, 0.0]], [[0.0, 0.0]]) model = _dim_two_gp() with pytest.raises(TF_DEBUGGING_ERROR_TYPES): builder.prepare_acquisition_function(data, model)
def test_batch_monte_carlo_expected_improvement_raises_for_empty_data( ) -> None: builder = BatchMonteCarloExpectedImprovement(100) data = Dataset(tf.zeros([0, 2]), tf.zeros([0, 1])) model = QuadraticMeanAndRBFKernel() with pytest.raises(TF_DEBUGGING_ERROR_TYPES): builder.prepare_acquisition_function(data, model)
def test_batch_monte_carlo_expected_improvement_raises_for_model_with_wrong_event_shape() -> None: builder = BatchMonteCarloExpectedImprovement(100) data = mk_dataset([(0.0, 0.0)], [(0.0, 0.0)]) matern52 = tfp.math.psd_kernels.MaternFiveHalves( amplitude=tf.cast(2.3, tf.float64), length_scale=tf.cast(0.5, tf.float64) ) model = GaussianProcess([lambda x: branin(x), lambda x: quadratic(x)], [matern52, rbf()]) with pytest.raises(TF_DEBUGGING_ERROR_TYPES): builder.prepare_acquisition_function(data, model)