Skip to content

Commit

Permalink
print warning of search space dimension not 1d-array-like
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBlanke committed Nov 20, 2021
1 parent 58cb896 commit 8459842
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions hyperactive/search_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,24 @@ def _string_or_object(self, dim_values):
is_func = self.is_function(dim_value)

if not is_str and not is_func:
err_msg = "\n The value '{}' in the search space must be number, string or function \n".format(
msg = "\n The value '{}' in the search space must be number, string or function \n".format(
dim_value
)
print("Warning: ", err_msg)
# raise ValueError(err_msg)
print("Warning: ", msg)
# raise ValueError(msg)

def check_non_num_values(self):
for dim_key in self.dim_keys:
dim_values = np.array(list(self.search_space[dim_key]))

try:
np.subtract(dim_values, dim_values)

if dim_values.ndim != 1:
msg = "Array in '{}' must be one dimensional".format(dim_key)
print("Warning: ", msg)
raise ValueError

except:
self._string_or_object(dim_values)
else:
if dim_values.ndim != 1:
msg = "Array-like object in '{}' must be one dimensional".format(
dim_key
)
print("Warning: ", msg)
# raise ValueError(msg)

0 comments on commit 8459842

Please sign in to comment.