Skip to content

Commit 923bd28

Browse files
committed
less strict fix for #325
1 parent 6a17ba4 commit 923bd28

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ The `BayesianOptimization` object fires a number of internal events during optim
243243

244244

245245
```python
246-
logger = JSONLogger(path="./logs.json")
246+
logger = JSONLogger(path="./logs.log")
247247
optimizer.subscribe(Events.OPTIMIZATION_STEP, logger)
248248

249-
# Results will be saved in ./logs.json
249+
# Results will be saved in ./logs.log
250250
optimizer.maximize(
251251
init_points=2,
252252
n_iter=3,
@@ -272,7 +272,7 @@ new_optimizer = BayesianOptimization(
272272
)
273273

274274
# New optimizer is loaded with previously seen points
275-
load_logs(new_optimizer, logs=["./logs.json"]);
275+
load_logs(new_optimizer, logs=["./logs.log"]);
276276
```
277277

278278
## Next Steps

bayes_opt/logger.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ def update(self, event, instance):
137137
class JSONLogger(_Tracker):
138138
def __init__(self, path, reset=True):
139139

140-
if not (Path(path).suffix) == '.log':
141-
warnings.warn('overwriting log extension with *.log"')
142-
self._path = str(Path(path).with_suffix('.log'))
140+
141+
self._path = path
143142
if reset:
144143
try:
145144
os.remove(self._path)

bayes_opt/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from scipy.stats import norm
44
from scipy.optimize import minimize
55
from colorama import just_fix_windows_console
6-
from pathlib import Path
6+
import json
77

88

99
def acq_max(ac, gp, y_max, bounds, random_state, constraint=None, n_warmup=10000, n_iter=10):
@@ -204,7 +204,7 @@ def load_logs(optimizer, logs):
204204
"""Load previous ...
205205
206206
"""
207-
import json
207+
208208

209209
if isinstance(logs, str):
210210
logs = [logs]

0 commit comments

Comments
 (0)