| @@ 182-216 (lines=35) @@ | ||
| 179 | _verb_.no_meta_data(model_func) |
|
| 180 | return None, None |
|
| 181 | ||
| 182 | def _get_opt_meta_data(self): |
|
| 183 | results_dict = {} |
|
| 184 | para_list = [] |
|
| 185 | score_list = [] |
|
| 186 | ||
| 187 | for key in self.memory_dict.keys(): |
|
| 188 | pos = np.fromstring(key, dtype=int) |
|
| 189 | para = self._space_.pos2para(pos) |
|
| 190 | score = self.memory_dict[key] |
|
| 191 | ||
| 192 | for key in para.keys(): |
|
| 193 | if ( |
|
| 194 | not isinstance(para[key], int) |
|
| 195 | and not isinstance(para[key], float) |
|
| 196 | and not isinstance(para[key], str) |
|
| 197 | ): |
|
| 198 | ||
| 199 | para_dill = dill.dumps(para[key]) |
|
| 200 | para_hash = self._get_hash(para_dill) |
|
| 201 | ||
| 202 | with open( |
|
| 203 | self.func_path + str(para_hash) + ".pkl", "wb" |
|
| 204 | ) as pickle_file: |
|
| 205 | dill.dump(para_dill, pickle_file) |
|
| 206 | ||
| 207 | para[key] = para_hash |
|
| 208 | ||
| 209 | if score != 0: |
|
| 210 | para_list.append(para) |
|
| 211 | score_list.append(score) |
|
| 212 | ||
| 213 | results_dict["params"] = para_list |
|
| 214 | results_dict["mean_test_score"] = score_list |
|
| 215 | ||
| 216 | return results_dict |
|
| 217 | ||
| 218 | def _load_data_into_memory(self, paras, scores): |
|
| 219 | ||
| @@ 180-214 (lines=35) @@ | ||
| 177 | _verb_.no_meta_data(model_func) |
|
| 178 | return None, None |
|
| 179 | ||
| 180 | def _get_opt_meta_data(self): |
|
| 181 | results_dict = {} |
|
| 182 | para_list = [] |
|
| 183 | score_list = [] |
|
| 184 | ||
| 185 | for key in self.memory_dict.keys(): |
|
| 186 | pos = np.fromstring(key, dtype=int) |
|
| 187 | para = self._space_.pos2para(pos) |
|
| 188 | score = self.memory_dict[key] |
|
| 189 | ||
| 190 | for key in para.keys(): |
|
| 191 | if ( |
|
| 192 | not isinstance(para[key], int) |
|
| 193 | and not isinstance(para[key], float) |
|
| 194 | and not isinstance(para[key], str) |
|
| 195 | ): |
|
| 196 | ||
| 197 | para_dill = dill.dumps(para[key]) |
|
| 198 | para_hash = self._get_hash(para_dill) |
|
| 199 | ||
| 200 | with open( |
|
| 201 | self.func_path + str(para_hash) + ".pkl", "wb" |
|
| 202 | ) as pickle_file: |
|
| 203 | dill.dump(para_dill, pickle_file) |
|
| 204 | ||
| 205 | para[key] = para_hash |
|
| 206 | ||
| 207 | if score != 0: |
|
| 208 | para_list.append(para) |
|
| 209 | score_list.append(score) |
|
| 210 | ||
| 211 | results_dict["params"] = para_list |
|
| 212 | results_dict["mean_test_score"] = score_list |
|
| 213 | ||
| 214 | return results_dict |
|
| 215 | ||
| 216 | def _load_data_into_memory(self, paras, scores): |
|
| 217 | ||