|
@@ 157-182 (lines=26) @@
|
| 154 |
|
opt.search(search_config) |
| 155 |
|
|
| 156 |
|
|
| 157 |
|
def test_long_term_memory_search_space_reduction(): |
| 158 |
|
def model6(para, X_train, y_train): |
| 159 |
|
model = DecisionTreeClassifier( |
| 160 |
|
criterion=para["criterion"], max_depth=para["max_depth"] |
| 161 |
|
) |
| 162 |
|
scores = cross_val_score(model, X_train, y_train, cv=2) |
| 163 |
|
|
| 164 |
|
return scores.mean() |
| 165 |
|
|
| 166 |
|
search_config = { |
| 167 |
|
model6: {"criterion": ["gini", "entropy"], "max_depth": range(1, 11)} |
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
opt = Hyperactive(X, y, memory="long") |
| 171 |
|
opt.search(search_config) |
| 172 |
|
|
| 173 |
|
def model6(para, X_train, y_train): |
| 174 |
|
model = DecisionTreeClassifier(criterion=para["criterion"]) |
| 175 |
|
scores = cross_val_score(model, X_train, y_train, cv=2) |
| 176 |
|
|
| 177 |
|
return scores.mean() |
| 178 |
|
|
| 179 |
|
search_config = {model6: {"criterion": ["gini", "entropy"]}} |
| 180 |
|
|
| 181 |
|
opt = Hyperactive(X, y, memory="long") |
| 182 |
|
opt.search(search_config) |
| 183 |
|
|
|
@@ 129-154 (lines=26) @@
|
| 126 |
|
assert best_para == opt2.results[model] |
| 127 |
|
|
| 128 |
|
|
| 129 |
|
def test_long_term_memory_search_space_expansion(): |
| 130 |
|
def model5(para, X_train, y_train): |
| 131 |
|
model = DecisionTreeClassifier(criterion=para["criterion"]) |
| 132 |
|
scores = cross_val_score(model, X_train, y_train, cv=2) |
| 133 |
|
|
| 134 |
|
return scores.mean() |
| 135 |
|
|
| 136 |
|
search_config = {model5: {"criterion": ["gini", "entropy"]}} |
| 137 |
|
|
| 138 |
|
opt = Hyperactive(X, y, memory="long") |
| 139 |
|
opt.search(search_config) |
| 140 |
|
|
| 141 |
|
def model5(para, X_train, y_train): |
| 142 |
|
model = DecisionTreeClassifier( |
| 143 |
|
criterion=para["criterion"], max_depth=para["max_depth"] |
| 144 |
|
) |
| 145 |
|
scores = cross_val_score(model, X_train, y_train, cv=2) |
| 146 |
|
|
| 147 |
|
return scores.mean() |
| 148 |
|
|
| 149 |
|
search_config = { |
| 150 |
|
model5: {"criterion": ["gini", "entropy"], "max_depth": range(1, 11)} |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
opt = Hyperactive(X, y, memory="long") |
| 154 |
|
opt.search(search_config) |
| 155 |
|
|
| 156 |
|
|
| 157 |
|
def test_long_term_memory_search_space_reduction(): |