|
7 | 7 | from sklearn.utils.validation import check_array |
8 | 8 | from sklearn.utils.validation import check_is_fitted |
9 | 9 | from sklearn.utils.validation import check_X_y |
10 | | -from skopt.space import Categorical |
11 | | -from skopt.space import Integer |
12 | | -from skopt.space import Real |
13 | 10 |
|
14 | 11 |
|
15 | 12 | class GradientBoosting(BaseEstimator, RegressorMixin): |
@@ -101,33 +98,17 @@ def predict(self, X): |
101 | 98 |
|
102 | 99 | def get_grid_params(self, search_type="random"): |
103 | 100 | """Returns the grid parameters of the emulator.""" |
104 | | - param_space_random = { |
105 | | - "learning_rate": loguniform(0.01, 0.2), |
106 | | - "n_estimators": randint(100, 500), |
107 | | - "max_depth": randint(3, 8), |
108 | | - "min_samples_split": randint(2, 20), |
109 | | - "min_samples_leaf": randint(1, 6), |
110 | | - "subsample": uniform(0.6, 0.4), # 0.4 is the range width (1.0 - 0.6) |
111 | | - "max_features": ["sqrt", "log2", None], |
112 | | - "ccp_alpha": loguniform(0.001, 0.1), |
113 | | - } |
114 | | - |
115 | | - param_space_bayes = { |
116 | | - "learning_rate": Real(0.01, 0.2, prior="log-uniform"), |
117 | | - "n_estimators": Integer(100, 500), |
118 | | - "max_depth": Integer(3, 8), |
119 | | - "min_samples_split": Integer(2, 20), |
120 | | - "min_samples_leaf": Integer(1, 6), |
121 | | - "subsample": Real(0.6, 1.0), |
122 | | - "max_features": Categorical(["sqrt", "log2", None]), |
123 | | - "ccp_alpha": Real(0.01, 0.1, prior="log-uniform"), |
124 | | - } |
125 | | - |
126 | 101 | if search_type == "random": |
127 | | - param_space = param_space_random |
128 | | - elif search_type == "bayes": |
129 | | - param_space = param_space_bayes |
130 | | - |
| 102 | + param_space = { |
| 103 | + "learning_rate": loguniform(0.01, 0.2), |
| 104 | + "n_estimators": randint(100, 500), |
| 105 | + "max_depth": randint(3, 8), |
| 106 | + "min_samples_split": randint(2, 20), |
| 107 | + "min_samples_leaf": randint(1, 6), |
| 108 | + "subsample": uniform(0.6, 0.4), # 0.4 is the range width (1.0 - 0.6) |
| 109 | + "max_features": ["sqrt", "log2", None], |
| 110 | + "ccp_alpha": loguniform(0.001, 0.1), |
| 111 | + } |
131 | 112 | return param_space |
132 | 113 |
|
133 | 114 | @property |
|
0 commit comments