Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

InputWarpedGP gave TypeError, not able to use it with any acquisition type #317

Open
natarajan-chidambaram opened this issue Apr 28, 2020 · 0 comments

Comments

@natarajan-chidambaram
Copy link

natarajan-chidambaram commented Apr 28, 2020

I am not sure if I can post this here, but most of my issues were solved through the solutions given under the issues here. So could not find the best place to post this

  1. The documentation in https://gpyopt.readthedocs.io/en/latest/GPyOpt.methods.html#module-GPyOpt.methods.bayesian_optimization has a typo in "model_type". Using "InputWarpedGP" gave the model as NoneType, but using 'input_warped_GP' removed that error. The reference for this can be found in the module's Unit testing https://github.com/SheffieldML/GPyOpt/blob/master/GPyOpt/testing/functional_tests/test_input_warped_gp.py

  2. optprob = GPyOpt.methods.BayesianOptimization(localFunction,
    domain = climateBounds,
    model_type = 'input_warped_GP',
    eps = 1e-08,
    acquisition_type = 'EI',
    verbosity = True)
    resulted in the following error
    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\core\bo.py in run_optimization(self, max_iter, max_time, eps, context, verbosity, save_models_parameters, report_file, evaluations_file, models_file)
    143 break
    144
    --> 145 self.suggested_sample = self._compute_next_evaluations()
    146
    147 # --- Augment X

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\core\bo.py in _compute_next_evaluations(self, pending_zipped_X, ignored_zipped_X)
234
235 ### We zip the value in case there are categorical variables
--> 236 return self.space.zip_inputs(self.evaluator.compute_batch(duplicate_manager=duplicate_manager, context_manager= self.acquisition.optimizer.context_manager))
237
238 def _update_model(self, normalization_type='stats'):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\core\evaluators\sequential.py in compute_batch(self, duplicate_manager, context_manager)
20 Selects the new location to evaluate the objective.
21 """
---> 22 x, _ = self.acquisition.optimize(duplicate_manager=duplicate_manager)
23 return x

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\acquisitions\base.py in optimize(self, duplicate_manager)
57 """
58 if not self.analytical_gradient_acq:
---> 59 out = self.optimizer.optimize(f=self.acquisition_function, duplicate_manager=duplicate_manager)
60 else:
61 out = self.optimizer.optimize(f=self.acquisition_function, f_df=self.acquisition_function_withGradients, duplicate_manager=duplicate_manager)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\optimization\acquisition_optimizer.py in optimize(self, f, df, f_df, duplicate_manager)
68
69 ## -- Select the anchor points (with context)
---> 70 anchor_points = anchor_points_generator.get(duplicate_manager=duplicate_manager, context_manager=self.context_manager)
71
72 ## --- Applying local optimizers at the anchor points and update bounds of the optimizer (according to the context)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\optimization\anchor_points_generator.py in get(self, num_anchor, duplicate_manager, unique, context_manager)
57 X = X[non_duplicate_anchor_point_indexes,:]
58
---> 59 scores = self.get_anchor_point_scores(X)
60
61 anchor_points = X[np.argsort(scores)[:min(len(scores),num_anchor)], :]

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\optimization\anchor_points_generator.py in get_anchor_point_scores(self, X)
96 def get_anchor_point_scores(self, X):
97
---> 98 return self.objective(X).flatten()
99
100 class RandomAnchorPointsGenerator(AnchorPointsGenerator):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\acquisitions\base.py in acquisition_function(self, x)
35 Takes an acquisition and weights it so the domain and cost are taken into account.
36 """
---> 37 f_acqu = self._compute_acq(x)
38 cost_x, _ = self.cost_withGradients(x)
39 x_z = x if self.space.model_dimensionality == self.space.objective_dimensionality else self.space.zip_inputs(x)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\acquisitions\EI.py in _compute_acq(self, x)
34 Computes the Expected Improvement per unit of cost
35 """
---> 36 m, s = self.model.predict(x)
37 fmin = self.model.get_fmin()
38 phi, Phi, u = get_quantiles(self.jitter, fmin, m, s)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\models\gpmodel.py in predict(self, X, with_noise)
108 with_noise (bool) - whether to add noise to the prediction. Default is True.
109 """
--> 110 m, v = self._predict(X, False, with_noise)
111 # We can take the square root because v is just a diagonal matrix of variances
112 return m, np.sqrt(v)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\GPyOpt\models\gpmodel.py in _predict(self, X, full_cov, include_likelihood)
96 if X.ndim == 1:
97 X = X[None,:]
---> 98 m, v = self.model.predict(X, full_cov=full_cov, include_likelihood=include_likelihood)
99 v = np.clip(v, 1e-10, np.inf)
100 return m, v

TypeError: predict() got an unexpected keyword argument 'full_cov'

Kindly let me know if there is any mistake on my side or the package should be altered.

Regards,
Natarajan

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant