|
@@ 54-71 (lines=18) @@
|
| 51 |
|
opt.search(search_config) |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
def test_long_term_memory_without_data(): |
| 55 |
|
def model3(para, X_train, y_train): |
| 56 |
|
model = DecisionTreeClassifier( |
| 57 |
|
criterion=para["criterion"], max_depth=para["max_depth"] |
| 58 |
|
) |
| 59 |
|
scores = cross_val_score(model, X_train, y_train, cv=2) |
| 60 |
|
|
| 61 |
|
return scores.mean() |
| 62 |
|
|
| 63 |
|
search_config = { |
| 64 |
|
model3: {"criterion": ["gini", "entropy"], "max_depth": range(1, 11)} |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
opt = Hyperactive(X, y, memory="long") |
| 68 |
|
opt.search(search_config, n_iter=0) |
| 69 |
|
|
| 70 |
|
opt = Hyperactive(X, y, memory="long") |
| 71 |
|
opt.search(search_config) |
| 72 |
|
|
| 73 |
|
|
| 74 |
|
def test_long_term_memory_best_model(): |
|
@@ 34-51 (lines=18) @@
|
| 31 |
|
assert np.array(opt.eval_times[model1]).mean() < 1 |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
def test_long_term_memory_with_data(): |
| 35 |
|
def model2(para, X_train, y_train): |
| 36 |
|
model = DecisionTreeClassifier( |
| 37 |
|
criterion=para["criterion"], max_depth=para["max_depth"] |
| 38 |
|
) |
| 39 |
|
scores = cross_val_score(model, X_train, y_train, cv=2) |
| 40 |
|
|
| 41 |
|
return scores.mean() |
| 42 |
|
|
| 43 |
|
search_config = { |
| 44 |
|
model2: {"criterion": ["gini", "entropy"], "max_depth": range(1, 11)} |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
opt = Hyperactive(X, y, memory="long") |
| 48 |
|
opt.search(search_config) |
| 49 |
|
|
| 50 |
|
opt = Hyperactive(X, y, memory="long") |
| 51 |
|
opt.search(search_config) |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
def test_long_term_memory_without_data(): |