| @@ 152-176 (lines=25) @@ | ||
| 149 | assert abs(best_score0 - best_score1) < err |
|
| 150 | ||
| 151 | ||
| 152 | def test_random_state_2(): |
|
| 153 | hyper0 = HillClimbingOptimizer() |
|
| 154 | hyper0.add_search( |
|
| 155 | experiment, |
|
| 156 | search_config, |
|
| 157 | n_iter=10, |
|
| 158 | initialize={"random": 1}, |
|
| 159 | random_state=1, |
|
| 160 | ) |
|
| 161 | hyper0.run() |
|
| 162 | ||
| 163 | hyper1 = HillClimbingOptimizer() |
|
| 164 | hyper1.add_search( |
|
| 165 | experiment, |
|
| 166 | search_config, |
|
| 167 | n_iter=10, |
|
| 168 | initialize={"random": 1}, |
|
| 169 | random_state=10, |
|
| 170 | ) |
|
| 171 | hyper1.run() |
|
| 172 | ||
| 173 | best_score0 = hyper0.best_score(experiment) |
|
| 174 | best_score1 = hyper1.best_score(experiment) |
|
| 175 | ||
| 176 | assert abs(best_score0 - best_score1) > err |
|
| 177 | ||
| 178 | ||
| 179 | def test_no_random_state_0(): |
|
| @@ 125-149 (lines=25) @@ | ||
| 122 | assert abs(best_score0 - best_score1) < err |
|
| 123 | ||
| 124 | ||
| 125 | def test_random_state_1(): |
|
| 126 | hyper0 = HillClimbingOptimizer() |
|
| 127 | hyper0.add_search( |
|
| 128 | experiment, |
|
| 129 | search_config, |
|
| 130 | n_iter=10, |
|
| 131 | initialize={"random": 1}, |
|
| 132 | random_state=10, |
|
| 133 | ) |
|
| 134 | hyper0.run() |
|
| 135 | ||
| 136 | hyper1 = HillClimbingOptimizer() |
|
| 137 | hyper1.add_search( |
|
| 138 | experiment, |
|
| 139 | search_config, |
|
| 140 | n_iter=10, |
|
| 141 | initialize={"random": 1}, |
|
| 142 | random_state=10, |
|
| 143 | ) |
|
| 144 | hyper1.run() |
|
| 145 | ||
| 146 | best_score0 = hyper0.best_score(experiment) |
|
| 147 | best_score1 = hyper1.best_score(experiment) |
|
| 148 | ||
| 149 | assert abs(best_score0 - best_score1) < err |
|
| 150 | ||
| 151 | ||
| 152 | def test_random_state_2(): |
|
| @@ 98-122 (lines=25) @@ | ||
| 95 | assert int(len(results) / n_jobs) != len(no_dup) |
|
| 96 | ||
| 97 | ||
| 98 | def test_random_state_0(): |
|
| 99 | hyper0 = HillClimbingOptimizer() |
|
| 100 | hyper0.add_search( |
|
| 101 | experiment, |
|
| 102 | search_config, |
|
| 103 | n_iter=10, |
|
| 104 | initialize={"random": 1}, |
|
| 105 | random_state=1, |
|
| 106 | ) |
|
| 107 | hyper0.run() |
|
| 108 | ||
| 109 | hyper1 = HillClimbingOptimizer() |
|
| 110 | hyper1.add_search( |
|
| 111 | experiment, |
|
| 112 | search_config, |
|
| 113 | n_iter=10, |
|
| 114 | initialize={"random": 1}, |
|
| 115 | random_state=1, |
|
| 116 | ) |
|
| 117 | hyper1.run() |
|
| 118 | ||
| 119 | best_score0 = hyper0.best_score(experiment) |
|
| 120 | best_score1 = hyper1.best_score(experiment) |
|
| 121 | ||
| 122 | assert abs(best_score0 - best_score1) < err |
|
| 123 | ||
| 124 | ||
| 125 | def test_random_state_1(): |
|