| @@ 86-109 (lines=24) @@ | ||
| 83 | assert 10 in list(hyper.search_data(experiment)["x1"].values) |
|
| 84 | ||
| 85 | ||
| 86 | def test_attributes_results_6(): |
|
| 87 | def objective_function(opt): |
|
| 88 | score = -opt["x1"] * opt["x1"] |
|
| 89 | return score |
|
| 90 | ||
| 91 | search_space = { |
|
| 92 | "x1": list(np.arange(0, 10, 1)), |
|
| 93 | } |
|
| 94 | ||
| 95 | hyper = HillClimbingOptimizer() |
|
| 96 | hyper.add_search( |
|
| 97 | experiment, |
|
| 98 | search_config, |
|
| 99 | n_iter=20, |
|
| 100 | initialize={"random": 1}, |
|
| 101 | memory=False, |
|
| 102 | ) |
|
| 103 | hyper.run() |
|
| 104 | ||
| 105 | x1_results = list(hyper.search_data(experiment)["x1"].values) |
|
| 106 | ||
| 107 | print("\n x1_results \n", x1_results) |
|
| 108 | ||
| 109 | assert len(set(x1_results)) < len(x1_results) |
|
| 110 | ||
| 111 | ||
| 112 | def test_attributes_results_7(): |
|
| @@ 81-104 (lines=24) @@ | ||
| 78 | assert 10 in list(hyper.search_data(objective_function)["x1"].values) |
|
| 79 | ||
| 80 | ||
| 81 | def test_attributes_results_6(): |
|
| 82 | def objective_function(opt): |
|
| 83 | score = -opt["x1"] * opt["x1"] |
|
| 84 | return score |
|
| 85 | ||
| 86 | search_space = { |
|
| 87 | "x1": list(np.arange(0, 10, 1)), |
|
| 88 | } |
|
| 89 | ||
| 90 | hyper = Hyperactive() |
|
| 91 | hyper.add_search( |
|
| 92 | objective_function, |
|
| 93 | search_space, |
|
| 94 | n_iter=20, |
|
| 95 | initialize={"random": 1}, |
|
| 96 | memory=False, |
|
| 97 | ) |
|
| 98 | hyper.run() |
|
| 99 | ||
| 100 | x1_results = list(hyper.search_data(objective_function)["x1"].values) |
|
| 101 | ||
| 102 | print("\n x1_results \n", x1_results) |
|
| 103 | ||
| 104 | assert len(set(x1_results)) < len(x1_results) |
|
| 105 | ||
| 106 | ||
| 107 | def test_attributes_results_7(): |
|