Unverified Commit e08515ce authored by Erik Fäßler's avatar Erik Fäßler Committed by GitHub
Browse files

Fix bug where numpy array is used as a truth value (#4286)

parent e875f1db
...@@ -243,7 +243,7 @@ class CG_BOHB: ...@@ -243,7 +243,7 @@ class CG_BOHB:
while np.any(nan_indices): while np.any(nan_indices):
nan_idx = nan_indices[0] nan_idx = nan_indices[0]
valid_indices = np.argwhere(np.isfinite(array[:, nan_idx])).flatten() valid_indices = np.argwhere(np.isfinite(array[:, nan_idx])).flatten()
if valid_indices: if len(valid_indices) > 0:
# pick one of them at random and overwrite all NaN values # pick one of them at random and overwrite all NaN values
row_idx = np.random.choice(valid_indices) row_idx = np.random.choice(valid_indices)
datum[nan_indices] = array[row_idx, nan_indices] datum[nan_indices] = array[row_idx, nan_indices]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment