@@ -117,9 +117,61 @@ def _get_sampler(self):
117117 @classmethod
118118 def get_test_params (cls , parameter_set = "default" ):
119119 """Return testing parameter settings for the optimizer."""
120+ from hyperactive .experiment .integrations import SklearnCvExperiment
121+ from sklearn .datasets import load_wine
122+ from sklearn .ensemble import RandomForestClassifier
123+ from sklearn .svm import SVC
124+
125+ # Test case 1: Basic TPE with standard parameters
120126 params = super ().get_test_params (parameter_set )
121127 params [0 ].update ({
122128 "n_startup_trials" : 5 ,
123129 "n_ei_candidates" : 12 ,
124130 })
131+
132+ # Test case 2: Mixed parameter types with warm start
133+ X , y = load_wine (return_X_y = True )
134+ rf_exp = SklearnCvExperiment (estimator = RandomForestClassifier (random_state = 42 ), X = X , y = y )
135+
136+ mixed_param_space = {
137+ "n_estimators" : (10 , 100 ), # Continuous integer
138+ "max_depth" : [3 , 5 , 7 , 10 , None ], # Mixed discrete/None
139+ "criterion" : ["gini" , "entropy" ], # Categorical
140+ "min_samples_split" : (2 , 20 ), # Continuous integer
141+ "bootstrap" : [True , False ], # Boolean
142+ }
143+
144+ # Warm start with known good configuration
145+ warm_start_points = [
146+ {"n_estimators" : 50 , "max_depth" : 5 , "criterion" : "gini" ,
147+ "min_samples_split" : 2 , "bootstrap" : True }
148+ ]
149+
150+ params .append ({
151+ "param_space" : mixed_param_space ,
152+ "n_trials" : 20 ,
153+ "experiment" : rf_exp ,
154+ "n_startup_trials" : 3 , # Fewer random trials before TPE
155+ "n_ei_candidates" : 24 , # More EI candidates for better optimization
156+ "initialize" : {"warm_start" : warm_start_points },
157+ })
158+
159+ # Test case 3: High-dimensional continuous space (TPE strength)
160+ svm_exp = SklearnCvExperiment (estimator = SVC (), X = X , y = y )
161+ high_dim_space = {
162+ "C" : (0.01 , 100 ),
163+ "gamma" : (1e-6 , 1e2 ),
164+ "coef0" : (0.0 , 10.0 ),
165+ "degree" : (2 , 5 ),
166+ "tol" : (1e-5 , 1e-2 ),
167+ }
168+
169+ params .append ({
170+ "param_space" : high_dim_space ,
171+ "n_trials" : 25 ,
172+ "experiment" : svm_exp ,
173+ "n_startup_trials" : 8 , # More startup for exploration
174+ "n_ei_candidates" : 32 , # More candidates for complex space
175+ })
176+
125177 return params
0 commit comments