|
3 | 3 | import time |
4 | 4 |
|
5 | 5 | import numpy as np |
6 | | -from numpy.lib.recfunctions import repack_fields |
7 | 6 | from gpcam import GPOptimizer as GP |
| 7 | +from numpy.lib.recfunctions import repack_fields |
8 | 8 |
|
9 | 9 | from libensemble.message_numbers import EVAL_GEN_TAG, FINISHED_PERSISTENT_GEN_TAG, PERSIS_STOP, STOP_TAG |
10 | 10 | from libensemble.tools.persistent_support import PersistentSupport |
@@ -38,14 +38,14 @@ def _initialize_gpcAM(user_specs, libE_info): |
38 | 38 |
|
39 | 39 | def _read_testpoints(U): |
40 | 40 | """Read numpy file containing evaluated points for measuring GP error""" |
41 | | - test_points_file = U.get('test_points_file') |
| 41 | + test_points_file = U.get("test_points_file") |
42 | 42 | if test_points_file is None: |
43 | 43 | return None |
44 | 44 |
|
45 | 45 | test_points = np.load(test_points_file) |
46 | 46 |
|
47 | 47 | # Remove any NaNs |
48 | | - nan_indices = [i for i, fval in enumerate(test_points['f']) if np.isnan(fval)] |
| 48 | + nan_indices = [i for i, fval in enumerate(test_points["f"]) if np.isnan(fval)] |
49 | 49 | test_points = np.delete(test_points, nan_indices, axis=0) |
50 | 50 |
|
51 | 51 | # In case large fields we don't need |
@@ -103,7 +103,7 @@ def _update_gp_and_eval_var(all_x, all_y, x_for_var, test_points, persis_info): |
103 | 103 |
|
104 | 104 | if test_points is not None: |
105 | 105 | f_est = my_gp2S.posterior_mean(test_points["x"])["f(x)"] |
106 | | - mse = np.mean((f_est - test_points["f"])**2) |
| 106 | + mse = np.mean((f_est - test_points["f"]) ** 2) |
107 | 107 | persis_info.setdefault("mean_squared_error", []).append(mse) |
108 | 108 | return np.array(var_vals) |
109 | 109 |
|
|
0 commit comments