Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed one_hot.py (#72)
Summary:
This is a hot fix for `is_valid_type` checking in ./core/search_space.py:
```python
if not self._parameters[name].is_valid_type(value):
    if raise_error:
        raise ValueError(
            f"{value} is not a valid value for "
            f"parameter {self._parameters[name]}"
        )
    return False
```
Since np.str_ couldn't pass the type checking
Pull Request resolved: #72

Reviewed By: lena-kashtelyan

Differential Revision: D15218362

Pulled By: sdsingh

fbshipit-source-id: b5142e387e46c991156073d7baf4f64102b70426
  • Loading branch information
carefree0910 authored and facebook-github-bot committed May 6, 2019
1 parent 6011bcb commit 8f7fb13
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ax/modelbridge/transforms/one_hot.py
Expand Up @@ -151,6 +151,8 @@ def untransform_observation_features(
val = self.encoder[p_name].inverse_transform(encoded_labels=x[None, :])[
0
]
if isinstance(val, np.str_):
val = str(val)
if isinstance(val, np.bool_):
val = bool(val) # Numpy bools don't serialize
obsf.parameters[p_name] = val
Expand Down

0 comments on commit 8f7fb13

Please sign in to comment.