Skip to content

Commit 66249ba

Browse files
committed
Added API compatibility functions
1 parent 6a8f302 commit 66249ba

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

bayes_opt/bayesian_optimization.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import division
33

44
import numpy as np
5+
import warnings
56
from sklearn.gaussian_process import GaussianProcessRegressor
67
from sklearn.gaussian_process.kernels import Matern
78
from .helpers import (UtilityFunction, PrintLog, unique_rows, acq_max,
@@ -317,3 +318,35 @@ def points_to_csv(self, file_name):
317318
points = np.hstack((self.space.X, np.expand_dims(self.space.Y, axis=1)))
318319
header = ', '.join(self.space.keys + ['target'])
319320
np.savetxt(file_name, points, header=header, delimiter=',')
321+
322+
# --- API compatibility ---
323+
324+
@property
325+
def X(self):
326+
warnings.warn("use self.space.X instead", DeprecationWarning)
327+
return self.space.X
328+
329+
@property
330+
def Y(self):
331+
warnings.warn("use self.space.Y instead", DeprecationWarning)
332+
return self.space.Y
333+
334+
@property
335+
def keys(self):
336+
warnings.warn("use self.space.keys instead", DeprecationWarning)
337+
return self.space.keys
338+
339+
@property
340+
def f(self):
341+
warnings.warn("use self.space.target_func instead", DeprecationWarning)
342+
return self.space.target_func
343+
344+
@property
345+
def bounds(self):
346+
warnings.warn("use self.space.dim instead", DeprecationWarning)
347+
return self.space.bounds
348+
349+
@property
350+
def dim(self):
351+
warnings.warn("use self.space.dim instead", DeprecationWarning)
352+
return self.space.dim

0 commit comments

Comments
 (0)