@@ -17,35 +17,50 @@ def sample_data_y1d():
1717 return X , y
1818
1919
20+ @pytest .fixture
21+ def new_data_y1d ():
22+ X , y = make_regression (n_samples = 20 , n_features = 5 , n_targets = 1 , random_state = 1 )
23+ return X , y
24+
25+
2026@pytest .fixture
2127def sample_data_y2d ():
2228 X , y = make_regression (n_samples = 20 , n_features = 5 , n_targets = 2 , random_state = 0 )
2329 return X , y
2430
2531
32+ @pytest .fixture
33+ def new_data_y2d ():
34+ X , y = make_regression (n_samples = 20 , n_features = 5 , n_targets = 2 , random_state = 1 )
35+ return X , y
36+
37+
2638# test multitask GP
27- def test_multi_output_gpmt (sample_data_y2d ):
39+ def test_multi_output_gpmt (sample_data_y2d , new_data_y2d ):
2840 X , y = sample_data_y2d
2941 gp = GaussianProcessMT (random_state = 42 )
3042 gp .fit (X , y )
31- assert gp .predict (X ).shape == (20 , 2 )
43+ X2 , _ = new_data_y2d
44+ assert gp .predict (X2 ).shape == (20 , 2 )
3245
3346
34- def test_predict_with_uncertainty_gpmt (sample_data_y1d ):
47+ def test_predict_with_uncertainty_gpmt (sample_data_y1d , new_data_y1d ):
3548 X , y = sample_data_y1d
3649 y_shape = y .shape
3750 gp = GaussianProcessMT (random_state = 42 )
3851 gp .fit (X , y )
39- y_pred , y_std = gp .predict (X , return_std = True )
52+ X2 , _ = new_data_y1d
53+ y_pred , y_std = gp .predict (X2 , return_std = True )
4054 assert y_pred .shape == y_shape
4155 assert y_std .shape == y_shape
4256
4357
44- def test_multitask_gpmt (sample_data_y2d ):
58+ def test_multitask_gpmt (sample_data_y2d , new_data_y2d ):
4559 X , y = sample_data_y2d
4660 gp = GaussianProcessMT (random_state = 42 )
4761 gp .fit (X , y )
48- y_pred , y_std = gp .predict (X , return_std = True )
62+ X2 , _ = new_data_y2d
63+ y_pred , y_std = gp .predict (X2 , return_std = True )
4964 assert y_pred .shape == y .shape
5065 assert y_std .shape == y .shape
5166
@@ -58,34 +73,38 @@ def test_gpmt_param_search(sample_data_y1d):
5873
5974
6075# test multioutput GP
61- def test_multioutput_gp (sample_data_y2d ):
76+ def test_multioutput_gp (sample_data_y2d , new_data_y2d ):
6277 X , y = sample_data_y2d
78+ X2 , _ = new_data_y2d
6379 gp = GaussianProcess (random_state = 42 )
6480 gp .fit (X , y )
6581 assert gp .predict (X ).shape == (20 , 2 )
6682
6783
68- def test_predict_with_uncertainty_gp (sample_data_y1d ):
84+ def test_predict_with_uncertainty_gp (sample_data_y1d , new_data_y1d ):
6985 X , y = sample_data_y1d
7086 y_shape = y .shape
7187 gp = GaussianProcess (random_state = 42 )
7288 gp .fit (X , y )
73- y_pred , y_std = gp .predict (X , return_std = True )
89+ X2 , _ = new_data_y1d
90+ y_pred , y_std = gp .predict (X2 , return_std = True )
7491 assert y_pred .shape == y_shape
7592 assert y_std .shape == y_shape
7693
7794
78- def test_multioutput_gp (sample_data_y2d ):
95+ def test_multioutput_gp (sample_data_y2d , new_data_y2d ):
7996 X , y = sample_data_y2d
97+ X2 , _ = new_data_y2d
8098 gp = GaussianProcess (random_state = 42 )
8199 gp .fit (X , y )
82- y_pred , y_std = gp .predict (X , return_std = True )
100+ y_pred , y_std = gp .predict (X2 , return_std = True )
83101 assert y_pred .shape == y .shape
84102 assert y_std .shape == y .shape
85103
86104
87- def test_gp_param_search (sample_data_y1d ):
105+ def test_gp_param_search (sample_data_y1d , new_data_y1d ):
88106 X , y = sample_data_y1d
107+ X2 , _ = new_data_y1d
89108 em = AutoEmulate ()
90109 em .setup (X , y , models = ["gp" ], param_search_iters = 3 )
91110 em .compare ()
0 commit comments