We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ensure_rng
AcquisitionFunction
1 parent 1714504 commit 9a464f2Copy full SHA for 9a464f2
bayes_opt/acquisition.py
@@ -38,6 +38,7 @@
38
TargetSpaceEmptyError,
39
)
40
from bayes_opt.target_space import TargetSpace
41
+from bayes_opt.util import ensure_rng
42
43
if TYPE_CHECKING:
44
from collections.abc import Callable, Sequence
@@ -60,13 +61,7 @@ class AcquisitionFunction(abc.ABC):
60
61
"""
62
63
def __init__(self, random_state: int | RandomState | None = None) -> None:
- if random_state is not None:
64
- if isinstance(random_state, RandomState):
65
- self.random_state = random_state
66
- else:
67
- self.random_state = RandomState(random_state)
68
69
- self.random_state = RandomState()
+ self.random_state = ensure_rng(random_state)
70
self.i = 0
71
72
def _serialize_random_state(self) -> dict | None:
0 commit comments