Skip to content

Commit 0c9321d

Browse files
put 'method' in class definition Pt.2
1 parent 2da83b9 commit 0c9321d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

GPopt/GPOpt.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,6 @@ def lazyoptimize(
858858
abs_tol=None, # suggested 1e-4, for n_iter = 200
859859
min_budget=50, # minimum budget for early stopping
860860
func_args=None,
861-
method="bayesian", # "bayesian" or "mc
862861
estimators="all",
863862
type_pi="kde", # for now, 'kde', 'bootstrap', 'splitconformal'
864863
type_exec="independent", # "queue" or "independent" (default)
@@ -884,9 +883,6 @@ def lazyoptimize(
884883
func_args: a list;
885884
additional parameters for the objective function (if necessary)
886885
887-
method: an str;
888-
"bayesian" (default) for Gaussian posteriors or "mc" for Monte Carlo posteriors
889-
890886
estimators: an str or a list of strs (estimators names)
891887
if "all", then 30 models are fitted. Otherwise, only those provided in the list
892888
are adjusted; for example ["RandomForestRegressor", "Ridge"]
@@ -978,6 +974,7 @@ def lazyoptimize(
978974
seed=self.seed,
979975
n_jobs=self.n_jobs,
980976
acquisition=self.acquisition,
977+
method=self.method,
981978
min_value=self.min_value,
982979
surrogate_obj=copy.deepcopy(self.regressors[0][1]),
983980
)
@@ -987,7 +984,6 @@ def lazyoptimize(
987984
abs_tol=abs_tol, # suggested 1e-4, for n_iter = 200
988985
min_budget=min_budget, # minimum budget for early stopping
989986
func_args=func_args,
990-
method=method,
991987
)
992988

993989
score_next_param = gp_opt_obj_prev.y_min
@@ -1014,6 +1010,7 @@ def lazyoptimize(
10141010
seed=self.seed,
10151011
n_jobs=self.n_jobs,
10161012
acquisition=self.acquisition,
1013+
method=self.method,
10171014
min_value=self.min_value,
10181015
surrogate_obj=copy.deepcopy(self.regressors[i][1]),
10191016
x_init=np.asarray(gp_opt_obj_prev.parameters),
@@ -1099,6 +1096,7 @@ def lazyoptimize(
10991096
seed=self.seed,
11001097
n_jobs=self.n_jobs,
11011098
acquisition=self.acquisition,
1099+
method=self.method,
11021100
min_value=self.min_value,
11031101
surrogate_obj=copy.deepcopy(self.regressors[i][1]),
11041102
)
@@ -1148,6 +1146,7 @@ def foo(i):
11481146
seed=self.seed,
11491147
n_jobs=self.n_jobs,
11501148
acquisition=self.acquisition,
1149+
method=self.method,
11511150
min_value=self.min_value,
11521151
surrogate_obj=copy.deepcopy(self.regressors[i][1]),
11531152
)

examples/lazybranin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
22
import GPopt as gp
3+
import nnetsauce as ns
34
import numpy as np
45
from os import chdir
56
from scipy.optimize import minimize
7+
from sklearn.linear_model import Ridge
68

79
print(f"\n ----- Running: {os.path.basename(__file__)}... ----- \n")
810

@@ -54,4 +56,7 @@ def branin(x):
5456
n_iter=190,
5557
seed=4327)
5658

59+
print(f"gp_opt1.method: {gp_opt1.method}")
60+
5761
gp_opt1.lazyoptimize(verbose=2, abs_tol=1e-4)
62+

0 commit comments

Comments
 (0)