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

GPyOpt is not working with numpy 1.24.0 or higher #362

@tnakazato

Description

@tnakazato

GPyOpt doesn't work with the latest version of numpy (1.24.0 or higher) due to the "expred deprecations" of numpy 1.24.0, namely gh-22607, which removes some deprecated types including numpy.bool.

https://numpy.org/devdocs/release/1.24.0-notes.html#expired-deprecations

Here is an example traceback.

I would appreciate it if you could fix the problem.

File ~/pyenv/priism-py3.8/lib/python3.8/site-packages/priism-0.11.2-py3.8.egg/priism/core/imager.py:594, in SparseModelingImager._cv_bayesian(self, l1_list, ltsv_list, hp_scale, num_fold, imageprefix, maxiter, eps, clean_box, nonnegative, resultasinitialimage, bayesopt_maxiter)
    588 bounds = [
    589     {'name': 'var_1', 'type': 'discrete', 'domain': l1_list},
    590     {'name': 'var_2', 'type': 'discrete', 'domain': ltsv_list},
    591 ]
    593 problem = GPyOpt.methods.BayesianOptimization(__objective_function, bounds)
--> 594 problem.run_optimization(bayesopt_maxiter)
    595 # for debugging
    596 # problem.save_evaluations('cv_eval.txt')
    597 # problem.save_models('cv_model.txt')
    598 # problem.save_report('cv_report.txt')
    600 return self.CrossValidationResult(
    601     mse=result_mse, image=result_image,
    602     L1=result_L1, Ltsv=result_Ltsv
    603 )

File ~/pyenv/priism-py3.8/lib/python3.8/site-packages/GPyOpt/core/bo.py:137, in BO.run_optimization(self, max_iter, max_time, eps, context, verbosity, save_models_parameters, report_file, evaluations_file, models_file)
    134 while (self.max_time > self.cum_time):
    135     # --- Update model
    136     try:
--> 137         self._update_model(self.normalization_type)
    138     except np.linalg.linalg.LinAlgError:
    139         break

...

File ~/pyenv/priism-py3.8/lib/python3.8/site-packages/paramz/model.py:171, in Model.optimize_restarts(self, num_restarts, robust, verbose, parallel, num_processes, **kwargs)
    169 if not parallel:
    170     if i > 0:
--> 171         self.randomize()
    172     self.optimize(**kwargs)
    173 else:#pragma: no cover

File ~/pyenv/priism-py3.8/lib/python3.8/site-packages/GPy/core/__init__.py:80, in randomize(self, rand_gen, *args, **kwargs)
     78 x = self.param_array.copy()
     79 [np.put(x, ind, p.rvs(ind.size)) for p, ind in self.priors.items() if not p is None]
---> 80 unfixlist = np.ones((self.size,),dtype=np.bool)
     81 from paramz.transformations import __fixed__
     82 unfixlist[self.constraints[__fixed__]] = False

File ~/pyenv/priism-py3.8/lib/python3.8/site-packages/numpy/__init__.py:284, in __getattr__(attr)
    281     from .testing import Tester
    282     return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
    285                      "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'bool'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions