Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit da2f4c5

Browse files
xmatthiasglouppe
authored andcommitted
use np.issubtype for space validation
1 parent 2a49b6a commit da2f4c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

skopt/space/space.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class Real(Dimension):
244244
name : str or None
245245
Name associated with the dimension, e.g., "learning rate".
246246
247-
dtype : str or dtype, default=np.float64
247+
dtype : str or dtype, default=float
248248
float type which will be used in inverse_transform,
249249
can be float.
250250
@@ -272,8 +272,8 @@ def __init__(self, low, high, prior="uniform", base=10, transform=None,
272272
raise ValueError("dtype must be 'float', 'float16', 'float32'"
273273
"or 'float64'"
274274
" got {}".format(self.dtype))
275-
elif isinstance(self.dtype, type) and self.dtype\
276-
not in [float, np.float16, np.float32, np.float64]:
275+
elif isinstance(self.dtype, type) and \
276+
np.issubdtype(self.dtype, np.floating):
277277
raise ValueError("dtype must be float, np.float64"
278278
" got {}".format(self.dtype))
279279

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy