Bayesian optimisation library developped by Huawei Noah's Ark Library

Related tags

Deep Learning HEBO
Overview

Bayesian Optimisation Research

This directory contains official implementations for Bayesian optimisation works developped by Huawei R&D, Noah's Ark Lab.

Further instructions are provided in the README files associated to each project.

HEBO

drawing

Bayesian optimsation library developped by Huawei Noahs Ark Decision Making and Reasoning (DMnR) lab. The winning submission to the NeurIPS 2020 Black-Box Optimisation Challenge.

T-LBO

Codebase associated to: High-Dimensional Bayesian Optimisation withVariational Autoencoders and Deep Metric Learning

Abstract

We introduce a method based on deep metric learning to perform Bayesian optimisation over high-dimensional, structured input spaces using variational autoencoders (VAEs). By extending ideas from supervised deep metric learning, we address a longstanding problem in high-dimensional VAE Bayesian optimisation, namely how to enforce a discriminative latent space as an inductive bias. Importantly, we achieve such an inductive bias using just 1% of the available labelled data relative to previous work, highlighting the sample efficiency of our approach. As a theoretical contribution, we present a proof of vanishing regret for our method. As an empirical contribution, we present state-of-the-art results on real-world high-dimensional black-box optimisation problems including property-guided molecule generation. It is the hope that the results presented in this paper can act as a guiding principle for realising effective high-dimensional Bayesian optimisation.

Bayesian Optimisation with Compositional Optimisers

drawing

Codebase associated to: Are we Forgetting about Compositional Optimisers in Bayesian Optimisation?

Abstract

Bayesian optimisation presents a sample-efficient methodology for global optimisation. Within this framework, a crucial performance-determining subroutine is the maximisation of the acquisition function, a task complicated by the fact that acquisition functions tend to be non-convex and thus nontrivial to optimise. In this paper, we undertake a comprehensive empirical study of approaches to maximise the acquisition function. Additionally, by deriving novel, yet mathematically equivalent, compositional forms for popular acquisition functions, we recast the maximisation task as a compositional optimisation problem, allowing us to benefit from the extensive literature in this field. We highlight the empirical advantages of the compositional approach to acquisition function maximisation across 3958 individual experiments comprising synthetic optimisation tasks as well as tasks from Bayesmark. Given the generality of the acquisition function maximisation subroutine, we posit that the adoption of compositional optimisers has the potential to yield performance improvements across all domains in which Bayesian optimisation is currently being applied.

Codebase Contributors

Alexander I Cowen-Rivers, Antoine Grosnit, Alexandre Max Maravel, Ryan Rhys Griffiths, Wenlong Lyu, Zhi Wang.

Comments
  • ValueError: The value argument must be within the support

    ValueError: The value argument must be within the support

    2021-11-01 08:02:44.622 ERROR Traceback (most recent call last): File "/home/ma-user/work/automl-1.8_EI/vega/core/pipeline/pipeline.py", line 79, in run pipestep.do() File "/home/ma-user/work/automl-1.8_EI/vega/core/pipeline/search_pipe_step.py", line 55, in do self._dispatch_trainer(res) File "/home/ma-user/work/automl-1.8_EI/vega/core/pipeline/search_pipe_step.py", line 73, in _dispatch_trainer self.master.run(trainer, evaluator) File "/home/ma-user/work/automl-1.8_EI/vega/core/scheduler/local_master.py", line 63, in run self._update(step_name, worker_id) File "/home/ma-user/work/automl-1.8_EI/vega/core/scheduler/local_master.py", line 71, in _update self.update_func(step_name, worker_id) File "/home/ma-user/work/automl-1.8_EI/vega/core/pipeline/generator.py", line 131, in update self.search_alg.update(record.serialize()) File "/home/ma-user/work/automl-1.8_EI/vega/algorithms/hpo/hpo_base.py", line 84, in update self.hpo.add_score(config_id, int(rung_id), rewards) File "/home/ma-user/work/automl-1.8_EI/vega/algorithms/hpo/sha_base/boss.py", line 230, in add_score self._set_next_ssa() File "/home/ma-user/work/automl-1.8_EI/vega/algorithms/hpo/sha_base/boss.py", line 159, in _set_next_ssa configs = self.tuner.propose(self.iter_list[iter]) File "/home/ma-user/work/automl-1.8_EI/vega/algorithms/hpo/sha_base/hebo_adaptor.py", line 70, in propose suggestions = self.hebo.suggest(n_suggestions=num) File "/home/ma-user/work/model_zoo/HEBO-master/HEBO/hebo/optimizers/hebo.py", line 126, in suggest rec = opt.optimize(initial_suggest = best_x, fix_input = fix_input).drop_duplicates() File "/home/ma-user/work/model_zoo/HEBO-master/HEBO/hebo/acq_optimizers/evolution_optimizer.py", line 122, in optimize print("optimize: ", prob, algo,self.iter) File "/home/ma-user/miniconda3/envs/MindSpore-python3.7-aarch64/lib/python3.7/site-packages/pymoo/model/problem.py", line 448, in str s += "# f(xl): %s\n" % self.evaluate(self.xl)[0] File "/home/ma-user/miniconda3/envs/MindSpore-python3.7-aarch64/lib/python3.7/site-packages/pymoo/model/problem.py", line 267, in evaluate out = self._evaluate_batch(X, calc_gradient, out, *args, **kwargs) File "/home/ma-user/miniconda3/envs/MindSpore-python3.7-aarch64/lib/python3.7/site-packages/pymoo/model/problem.py", line 335, in _evaluate_batch self._evaluate(X, out, *args, **kwargs) File "/home/ma-user/work/model_zoo/HEBO-master/HEBO/hebo/acq_optimizers/evolution_optimizer.py", line 50, in _evaluate acq_eval = self.acq(xcont, xenum).numpy().reshape(num_x, self.acq.num_obj + self.acq.num_constr) File "/home/ma-user/work/model_zoo/HEBO-master/HEBO/hebo/acquisitions/acq.py", line 39, in call return self.eval(x, xe) File "/home/ma-user/work/model_zoo/HEBO-master/HEBO/hebo/acquisitions/acq.py", line 157, in eval log_phi = dist.log_prob(normed) File "/home/ma-user/miniconda3/envs/MindSpore-python3.7-aarch64/lib/python3.7/site-packages/torch/distributions/normal.py", line 73, in log_prob self._validate_sample(value) File "/home/ma-user/miniconda3/envs/MindSpore-python3.7-aarch64/lib/python3.7/site-packages/torch/distributions/distribution.py", line 277, in _validate_sample raise ValueError('The value argument must be within the support') ValueError: The value argument must be within the support

    opened by hujiaxin0 8
  • ValueError: NaN in distribution

    ValueError: NaN in distribution

    Hi, thanks for this repository! So far it works quite well, but now I suddenly encountered a weird error after 11 optimization steps of non-batched HEBO:

    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    /tmp/ipykernel_2773121/4102601230.py in <module>
         35 
         36 for i in range(opt_steps):
    ---> 37     rec = opt.suggest()
         38     if "bs" in rec:
         39         rec["bs"] = 2 ** rec["bs"]
    
    ~/.local/lib/python3.8/site-packages/hebo/optimizers/hebo.py in suggest(self, n_suggestions, fix_input)
        151             sig = Sigma(model, linear_a = -1.)
        152             opt = EvolutionOpt(self.space, acq, pop = 100, iters = 100, verbose = False, es=self.es)
    --> 153             rec = opt.optimize(initial_suggest = best_x, fix_input = fix_input).drop_duplicates()
        154             rec = rec[self.check_unique(rec)]
        155 
    
    ~/.local/lib/python3.8/site-packages/hebo/acq_optimizers/evolution_optimizer.py in optimize(self, initial_suggest, fix_input, return_pop)
        125         crossover = self.get_crossover()
        126         algo      = get_algorithm(self.es, pop_size = self.pop, sampling = init_pop, mutation = mutation, crossover = crossover, repair = self.repair)
    --> 127         res       = minimize(prob, algo, ('n_gen', self.iter), verbose = self.verbose)
        128         if res.X is not None and not return_pop:
        129             opt_x = res.X.reshape(-1, len(lb)).astype(float)
    
    ~/.local/lib/python3.8/site-packages/pymoo/optimize.py in minimize(problem, algorithm, termination, copy_algorithm, copy_termination, **kwargs)
         81 
         82     # actually execute the algorithm
    ---> 83     res = algorithm.run()
         84 
         85     # store the deep copied algorithm in the result object
    
    ~/.local/lib/python3.8/site-packages/pymoo/core/algorithm.py in run(self)
        211         # while termination criterion not fulfilled
        212         while self.has_next():
    --> 213             self.next()
        214 
        215         # create the result object to be returned
    
    ~/.local/lib/python3.8/site-packages/pymoo/core/algorithm.py in next(self)
        231         # call the advance with them after evaluation
        232         if infills is not None:
    --> 233             self.evaluator.eval(self.problem, infills, algorithm=self)
        234             self.advance(infills=infills)
        235 
    
    ~/.local/lib/python3.8/site-packages/pymoo/core/evaluator.py in eval(self, problem, pop, skip_already_evaluated, evaluate_values_of, count_evals, **kwargs)
         93         # actually evaluate all solutions using the function that can be overwritten
         94         if len(I) > 0:
    ---> 95             self._eval(problem, pop[I], evaluate_values_of=evaluate_values_of, **kwargs)
         96 
         97             # set the feasibility attribute if cv exists
    
    ~/.local/lib/python3.8/site-packages/pymoo/core/evaluator.py in _eval(self, problem, pop, evaluate_values_of, **kwargs)
        110         evaluate_values_of = self.evaluate_values_of if evaluate_values_of is None else evaluate_values_of
        111 
    --> 112         out = problem.evaluate(pop.get("X"),
        113                                return_values_of=evaluate_values_of,
        114                                return_as_dictionary=True,
    
    ~/.local/lib/python3.8/site-packages/pymoo/core/problem.py in evaluate(self, X, return_values_of, return_as_dictionary, *args, **kwargs)
        122 
        123         # do the actual evaluation for the given problem - calls in _evaluate method internally
    --> 124         self.do(X, out, *args, **kwargs)
        125 
        126         # make sure the array is 2d before doing the shape check
    
    ~/.local/lib/python3.8/site-packages/pymoo/core/problem.py in do(self, X, out, *args, **kwargs)
        160 
        161     def do(self, X, out, *args, **kwargs):
    --> 162         self._evaluate(X, out, *args, **kwargs)
        163         out_to_2d_ndarray(out)
        164 
    
    ~/.local/lib/python3.8/site-packages/hebo/acq_optimizers/evolution_optimizer.py in _evaluate(self, x, out, *args, **kwargs)
         46 
         47         with torch.no_grad():
    ---> 48             acq_eval = self.acq(xcont, xenum).numpy().reshape(num_x, self.acq.num_obj + self.acq.num_constr)
         49             out['F'] = acq_eval[:, :self.acq.num_obj]
         50 
    
    ~/.local/lib/python3.8/site-packages/hebo/acquisitions/acq.py in __call__(self, x, xe)
         37 
         38     def __call__(self, x : Tensor,  xe : Tensor):
    ---> 39         return self.eval(x, xe)
         40 
         41 class SingleObjectiveAcq(Acquisition):
    
    ~/.local/lib/python3.8/site-packages/hebo/acquisitions/acq.py in eval(self, x, xe)
        155             normed    = ((self.tau - self.eps - py - noise * torch.randn(py.shape)) / ps)
        156             dist      = Normal(0., 1.)
    --> 157             log_phi   = dist.log_prob(normed)
        158             Phi       = dist.cdf(normed)
        159             PI        = Phi
    
    ~/.local/lib/python3.8/site-packages/torch/distributions/normal.py in log_prob(self, value)
         71     def log_prob(self, value):
         72         if self._validate_args:
    ---> 73             self._validate_sample(value)
         74         # compute the variance
         75         var = (self.scale ** 2)
    
    ~/.local/lib/python3.8/site-packages/torch/distributions/distribution.py in _validate_sample(self, value)
        286         valid = support.check(value)
        287         if not valid.all():
    --> 288             raise ValueError(
        289                 "Expected value argument "
        290                 f"({type(value).__name__} of shape {tuple(value.shape)}) "
    
    ValueError: Expected value argument (Tensor of shape (100, 1)) to be within the support (Real()) of the distribution Normal(loc: 0.0, scale: 1.0), but found invalid values:
    tensor([[ -1.1836],
            [ -1.2862],
            [-11.6360],
            [-11.3412],
            [  0.3811],
            [ -2.0235],
            [ -1.7288],
            [ -8.3472],
            [-10.1714],
            [ -2.6084],
            [ -0.8098],
            [ -0.9687],
            [ -9.0626],
            [ -2.2273],
            [ -9.0942],
            [ -1.6956],
            [ -6.6197],
            [ -9.3882],
            [ -6.1594],
            [ -9.2895],
            [ -1.7074],
            [  0.8382],
            [-14.6693],
            [ -0.8303],
            [-10.2741],
            [  0.2808],
            [ -9.3681],
            [ -0.6729],
            [ -2.0288],
            [ -1.4389],
            [ -7.1975],
            [-11.5732],
            [-10.2751],
            [ -1.3800],
            [ -1.9773],
            [ -1.4668],
            [ -9.7166],
            [ -8.3093],
            [-15.5914],
            [ -0.0808],
            [  0.3732],
            [-16.2714],
            [ -2.3120],
            [ -8.7503],
            [ -1.6276],
            [     nan],
            [-15.3692],
            [ -9.1615],
            [ -9.8093],
            [ -2.0716],
            [ -1.9259],
            [  0.9543],
            [ -8.1521],
            [ -2.5709],
            [ -1.6153],
            [-10.7236],
            [ -0.0763],
            [  0.0543],
            [ -7.2755],
            [-10.6411],
            [ -7.9253],
            [-19.4996],
            [ -2.0001],
            [-11.7616],
            [-11.0187],
            [-12.0727],
            [ -1.3243],
            [-11.2528],
            [ -1.5527],
            [ -0.9219],
            [ -1.0130],
            [-10.1825],
            [-18.3420],
            [-11.1005],
            [ -8.5818],
            [-11.1588],
            [ -8.8115],
            [ -1.0410],
            [-15.2722],
            [ -1.8399],
            [ -1.0827],
            [ -1.0277],
            [ -6.4768],
            [ -8.3902],
            [ -0.9513],
            [ -1.3429],
            [ -1.0889],
            [ -7.2952],
            [ -7.8548],
            [ -0.0231],
            [ -7.1898],
            [-20.4194],
            [ -1.2503],
            [-19.6157],
            [ -0.3398],
            [-15.7221],
            [-10.3210],
            [ -9.5764],
            [ -0.2335],
            [ -0.3788]])
    

    Seems like there is a NaN in some distribution of HEBO. But my input parameters (opt.X) and losses (opt.y) are never NaN. This is the design space I'm using:

    space = DesignSpace().parse([{'name': 'lr', 'type' : 'num', 'lb' : 0.00005, 'ub' : 0.1},
                                     {'name': 'n_estimators', 'type' : 'int', 'lb' : 1, 'ub' : 20},  # multiplied by 10
                                     {'name': 'max_depth', 'type' : 'int', 'lb' : 1, 'ub' : 10},
                                     {'name': 'subsample', 'type' : 'num', 'lb' : 0.5, 'ub' : 0.99},
                                     {'name': 'colsample_bytree', 'type' : 'num', 'lb' : 0.5, 'ub' : 0.99},
                                     {'name': 'gamma', 'type' : 'num', 'lb' : 0.01, 'ub' : 10.0},
                                     {'name': 'min_child_weight', 'type' : 'int', 'lb' : 1, 'ub' : 10},
                                     
                                     {'name': 'fill_type', 'type' : 'cat', 'categories' : ['median', 'pat_median','pat_ema']},
                                     {'name': 'flat_block_size', 'type' : 'int', 'lb' : 1, 'ub' : 1}
                                    ])
        
    opt = HEBO(space)
    

    I already commented out flat_block_size as I thought that maybe it is a problem if lb == ub, but it still crashes.

    Any ideas on how I can debug this?

    opened by NotNANtoN 5
  • hebo take up too much cpus

    hebo take up too much cpus

    The main process of HEBO take up 1600% cpus, which makes other parts of the program run very slowly. Is there any way to reduce the cpu usage of hebo? Thanks!

    opened by Shaofei-Li 3
  • 'float' object cannot be interpreted as an integer

    'float' object cannot be interpreted as an integer

    I get the following error TypeError: 'float' object cannot be interpreted as an integer when attempting to search with a XGB model.

    space_cfg = [ {'name' : 'max_depth', 'type' : 'int', 'lb' : 1, 'ub' : 10}, {'name' : 'min_child_weight', 'type' : 'int', 'lb' : 1, 'ub' : 100}, {'name': 'n_estimators', 'type' : 'int', 'lb': 1, 'ub': 10000}, {'name': 'alpha', 'type': 'num', 'lb': 0, 'ub': 100}, {'name': 'lambda', 'type': 'num', 'lb': 0, 'ub': 100}, {'name': 'gamma', 'type': 'num', 'lb': 0, 'ub': 100}, {'name': 'eta', 'type': 'pow', 'lb': 1e-5, 'ub': 1}, {'name': 'colsample_bytree', 'type': 'num', 'lb': 1/3, 'ub': 1}, {'name': 'colsample_bylevel', 'type': 'num', 'lb': 1/3, 'ub': 1}, {'name': 'colsample_bynode', 'type': 'num', 'lb': 1/3, 'ub': 1}, {'name': 'subsample', 'type': 'num', 'lb': 1/27, 'ub': 100}, ]

    opened by replacementAI 3
  • HEBO demo codes fail

    HEBO demo codes fail

    Hi,

    I installed the HEBO library, and tried to run the demo codes here:

    1. https://github.com/huawei-noah/HEBO/tree/master/HEBO#demo
    2. https://github.com/huawei-noah/HEBO/tree/master/HEBO#auto-tuning-via-sklearn-estimator

    Both begin executing but eventually fail with the error: TypeError: __init__() got an unexpected keyword argument 'prob_per_variable'

    The complete stacktrace for the second demo code (auto-tuning sklearn estimator) is:

    Iter 0, best metric: 0.398791  
    Iter 1, best metric: 0.492467
    Iter 2, best metric: 0.658477
    Iter 3, best metric: 0.658477
    Iter 4, best metric: 0.658477
    Iter 5, best metric: 0.658477
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/redacted_path_1/HEBO-master/HEBO/hebo/sklearn_tuner.py", line 74, in sklearn_tuner
        rec     = opt.suggest()
      File "/redacted_path_1/HEBO-master/HEBO/hebo/optimizers/hebo.py", line 153, in suggest
        rec = opt.optimize(initial_suggest = best_x, fix_input = fix_input).drop_duplicates()
      File "/redacted_path_1/HEBO-master/HEBO/hebo/acq_optimizers/evolution_optimizer.py", line 126, in optimize
        algo      = get_algorithm(self.es, pop_size = self.pop, sampling = init_pop, mutation = mutation, crossover = crossover, repair = self.repair)
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/factory.py", line 85, in get_algorithm
        return get_from_list(get_algorithm_options(), name, args, {**d, **kwargs})
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/factory.py", line 49, in get_algorithm_options
        from pymoo.algorithms.moo.ctaea import CTAEA
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/algorithms/moo/ctaea.py", line 223, in <module>
        class CTAEA(GeneticAlgorithm):
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/algorithms/moo/ctaea.py", line 230, in CTAEA
        mutation=PM(eta=20, prob_per_variable=None),
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/operators/mutation/pm.py", line 77, in __init__
        super().__init__(prob=prob, **kwargs)
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/core/mutation.py", line 29, in __init__
        super().__init__(**kwargs)
      File "/redacted_path_2/anaconda3/lib/python3.7/site-packages/pymoo-0.6.0.dev0-py3.7-linux-x86_64.egg/pymoo/core/mutation.py", line 10, in __init__
        super().__init__(**kwargs)
    TypeError: __init__() got an unexpected keyword argument 'prob_per_variable'
    

    Can you provide pointers for fixing this? Thanks!

    opened by abhishek-ghose 2
  • Definition of

    Definition of "compositional" in "compositional optimizers"

    At one point, I may have understood this, but I find myself often wondering and asking again: what does "compositional" in "compositional optimizer" refer to? Part of my confusion probably stems from my materials informatics background, where composition often refers to the chemical make-up (i.e. chemical formula) of a particular compound. In other cases, it just implies that the contribution of individual components sums to one.

    https://github.com/huawei-noah/HEBO/tree/master/CompBO

    opened by sgbaird 2
  • Fix pymoo's ElementwiseProblem call in VCBO

    Fix pymoo's ElementwiseProblem call in VCBO

    Hello. VCBO optimizer call of pymoo's ElementwiseProblem is fixed. New version of pymoo requires that problem should be of type "ElementwiseProblem".

    opened by ajikmr 2
  • An unexpected bug

    An unexpected bug

    When I using hebo.sklearn_tuner to optimize the hyperparameters of xgboost, there is an error that "TypeError: 'float' object cannot be interpreted as an integer", so I made a breakpoint to enter the function to find out the reason. It's because the dataframe class method iloc will transform the data type from int to float, which will cause the error.

    opened by KNwbq 2
  • pymoo has no module 'algorithms.so_genetic_algorithm'

    pymoo has no module 'algorithms.so_genetic_algorithm'

    When running the example code for sklearn tuner, I get the following error message

    ModuleNotFoundError: No module named 'pymoo.algorithms.so_genetic_algorithm'

    The line of code in question is from pymoo.algorithms.so_genetic_algorithm import GA within evolution_optimizer.py

    I can reproduce it standalone as well (i.e. installing pymoo and trying to run that import), and I don't see this algorithm in pymoo's API reference.

    Looks like this comes from a breaking change in pymoo 0.5.0, which they detailed "The package structure has been modified to distinguish between single- and multi-objective optimization more clearly."

    Based on their updated API for version 0.5.0, I believe but am not sure that the genetic algorithm import needs to be changed to:

    from pymoo.algorithms.soo.nonconvex.ga import GA

    opened by nathanwalker-sp 2
  • sklearn_tuner.py example failing with pymoo version 0.5.0

    sklearn_tuner.py example failing with pymoo version 0.5.0

    Using the latest version of pymoo==0.5.0 the sklearn_tuner.py example fails with the error:

    ModuleNotFoundError: No module named 'pymoo.algorithms.so_genetic_algorithm'

    It would be great if we could either make the example compatible with pymoo==0.5.0 or update the requirements and install instructions to specify pymoo==0.4.2 as the required version.

    The example runs with pymoo==0.4.2 albeit breaks with a different error after 5 iterations:

    /Users/~/opt/miniconda3/envs/hebo/bin/python /Users/ryan_rhys/ml_physics/HEBO/HEBO/hebo/sklearn_tuner.py
    Iter 0, best metric: 0.389011
    Iter 1, best metric: 0.496764
    Iter 2, best metric: 0.649803
    Iter 3, best metric: 0.649803
    Iter 4, best metric: 0.649803
    Iter 5, best metric: 0.649803
    Traceback (most recent call last):
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/hebo/acq_optimizers/evolution_optimizer.py", line 119, in optimize
        res   = minimize(prob, algo, ('n_gen', self.iter), verbose = self.verbose)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/optimize.py", line 85, in minimize
        res = algorithm.solve()
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/algorithm.py", line 226, in solve
        self._solve(self.problem)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/algorithm.py", line 321, in _solve
        self.next()
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/algorithm.py", line 246, in next
        self._next()
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/algorithms/genetic_algorithm.py", line 93, in _next
        self.off = self.mating.do(self.problem, self.pop, self.n_offsprings, algorithm=self)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/infill.py", line 40, in do
        _off = self.eliminate_duplicates.do(_off, pop, off)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/duplicate.py", line 26, in do
        pop = pop[~self._do(pop, None, np.full(len(pop), False))]
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/duplicate.py", line 75, in _do
        D = self.calc_dist(pop, other)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/model/duplicate.py", line 66, in calc_dist
        D = cdist(X, X)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/pymoo/util/misc.py", line 90, in cdist
        return scipy.spatial.distance.cdist(A, B, **kwargs)
      File "/Users/~/opt/miniconda3/envs/hebo/lib/python3.8/site-packages/scipy/spatial/distance.py", line 2954, in cdist
        return cdist_fn(XA, XB, out=out, **kwargs)
    ValueError: Unsupported dtype object
    
    opened by Ryan-Rhys 2
  • The inverse_transform does not work as expected.

    The inverse_transform does not work as expected.

    Original Codes: https://github.com/huawei-noah/HEBO/blob/f9b7f578bd703ba2f47840a581bb4294faff1e12/HEBO/hebo/design_space/int_exponent_param.py#L33-L34

    As I understand here the function inverse_transform() should worked as taking a arbiraty input(s) as exponent, however we cannot guaranteed the input(s) as Int dtype. In such case, if we have codes as below:

    https://github.com/huawei-noah/HEBO/blob/f9b7f578bd703ba2f47840a581bb4294faff1e12/HEBO/hebo/optimizers/evolution.py#L71-L83

    Here x could be arbitary number, assuming we have x=np.array([5.4]), write some toy codes below to demostrate the problem:

    from hebo.design_space.int_exponent_param import IntExponentPara
    p = IntExponentPara({'name': 'p', 'base': 2, 'lb': 32, 'ub': 256})  # expected parameter values [32, 64, 128, 256]
    x = np.array([5.4])
    print(p.inverse_transform(x))
    # >>> [42]
    # 2**5.4=42.22, after astype(int) is 42, but not in valid values [32, 64, 128, 256]
    

    That is to say, what optimzer.evolution.suggest() produces suggested parameter(s) could violate its definition. To resovled this issue, I open a pull request. #33

    opened by kaimo455 1
  • pymoo 0.6.0 removed many files and functions used in hebo, causing im…

    pymoo 0.6.0 removed many files and functions used in hebo, causing im…

    …possible to use with python > 3.8; this fix moved those files (from pymoo 0.5.0) back to folder pymoo_fix; use torch.linalg.eig since Tensor.eig was removed after pytorch 1.9

    opened by gengjun 2
  • Support for conditional/hierarchical design spaces

    Support for conditional/hierarchical design spaces

    Can one specify a conditional/hierarchical search space to HEBO? I.e., something similar to SMAC3?

    E.g., only sample the number of convoutional filters in the second layer of a neural net only if we decide (by another parameter )to have a network with at least two layers.

    I'm thinking that this can be somewhat circumvented by returning a high cost value for infeasible combinations, but I imagine this might be a suboptimal approach as it might affect optimization performance since, e.g., some optima might lie on the edge of feasible regions, and the cost estimator, if it has some sort of smoothness prior (which they usually do), has a chance of assigning unfaithfully high cost values near the infeasible configurations - at least initially (i.e., the a priori probability of a kink in the error surface is generally lower).

    Some optimizers are able to address this by training a different model - a feasability predictor (which has the advantage of being able to work with unknown feasibility constraints).

    So how should one deal with this in HEBO?

    opened by bbudescu 0
  • Support for fixed parameters

    Support for fixed parameters

    Is it possible to have HEBO search the optimum over a design space where a parameter is defined in a regular fashion (e.g., as a real or integer), but also temporarily (i.e., during a single optimization session) to constrain the search space to a single value of that parameter, and to search only the subspace defined by the remaining unconstrained parameters?

    I.e., something similar to Optuna's PartialFixedSampler

    Why this is useful

    Context

    Generally, it is useful to be able to run several optimization sessions, and use results of trials from previous sessions to improve convergence in the current session. As far as I can understand from the docs, using HEBO, one can run a bunch of trials in one or more sessions and then use observe api calls to feed the previous results to the bayesian model before further exploring using suggest in the current session.

    Scenario no. 1 - Accelerate optimization by reducing the search space

    Now, as explained in the Optuna docs linked above and in the related issue, after running a bunch of trials, one might decide upon a particular value of a parameter, and want to prevent the optimizer from investing more time on exploring values of that parameter are clear not to yield better results, but taking into account the results obtained with other values of that parameter (along the dimensions of other unbound params, the trained cost predictor might still provide valuable insights).

    Scenario no. 2 - Transfer Learning

    If this is implemented, one could do transfer learning, in a fashion similar to the one proposed, e.g., by SMAC3 (they call this feature 'Optimization across Instances') or OpenBox, i.e., to reuse knowledge about high yield sub-regions from one instance (dataset/task) to another.

    Potential Solution

    I'm thinking that one could simply change the bounds of a particular parameter every time a new optimization session is started. However, I'm not quite sure that the observe call will accept values that are out of bounds, and, even if it doesn't crash, that the underlying bayesian model is trained correctly.

    opened by bbudescu 0
  • "High-dimensional optimisation via random linear embedding" example running error

    Hi!When I run this example, I got the following error image

    I noticed that when I set clip true ,the example run successfully,but When clip is the default value of False, the return value MACE_Embedding is not a kind of class MACE ,which lead to above error. image

    opened by Shaofei-Li 0
  • [Quick Fix] Licence in the Setup ?

    [Quick Fix] Licence in the Setup ?

    HI can you add licence info in the setup file ?

    Something like

    setup( .... , 
         classifiers=[
            'License :: OSI Approved :: MIT License',
         ]
    )
    

    This will make licenses flow through PyPi correctly

    opened by sanket-kamthe 0
Releases(v0.3.4)
Owner
HUAWEI Noah's Ark Lab
Working with and contributing to the open source community in data mining, artificial intelligence, and related fields.
HUAWEI Noah's Ark Lab
Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks

Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks. Bayesian-Torch is designed to be flexible and seamless in extending a deterministic deep neural network architecture to corresponding Bayesian form by simply replacing the deterministic layers with Bayesian layers.

Intel Labs 210 Jan 4, 2023
aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)

Bayesian Methods for Hackers Using Python and PyMC The Bayesian method is the natural approach to inference, yet it is hidden from readers behind chap

Cameron Davidson-Pilon 25.1k Jan 2, 2023
LBK 20 Dec 2, 2022
Ultra-lightweight human body posture key point CNN model. ModelSize:2.3MB HUAWEI P40 NCNN benchmark: 6ms/img,

Ultralight-SimplePose Support NCNN mobile terminal deployment Based on MXNET(>=1.5.1) GLUON(>=0.7.0) framework Top-down strategy: The input image is t

null 223 Dec 27, 2022
An implementation of quantum convolutional neural network with MindQuantum. Huawei, classifying MNIST dataset

关于实现的一点说明 山东大学 2020级 苏博南 www.subonan.com 文件说明 tools.py 这里面主要有两个函数: resize(a, lenb) 这其实是我找同学写的一个小算法hhh。给出一个$28\times 28$的方阵a,返回一个$lenb\times lenb$的方阵。因

ぼっけなす 2 Aug 29, 2022
Yolo ros - YOLO-ROS for HUAWEI ATLAS200

YOLO-ROS YOLO-ROS for NVIDIA YOLO-ROS for HUAWEI ATLAS200, please checkout for b

ChrisLiu 5 Oct 18, 2022
Paddle implementation for "Cross-Lingual Word Embedding Refinement by ℓ1 Norm Optimisation" (NAACL 2021)

L1-Refinement Paddle implementation for "Cross-Lingual Word Embedding Refinement by ℓ1 Norm Optimisation" (NAACL 2021) ?? A more detailed readme is co

Lincedo Lab 4 Jun 9, 2021
A Python-based development platform for automated trading systems - from backtesting to optimisation to livetrading.

AutoTrader AutoTrader is Python-based platform intended to help in the development, optimisation and deployment of automated trading systems. From sim

Kieran Mackle 485 Jan 9, 2023
Python Library for learning (Structure and Parameter) and inference (Statistical and Causal) in Bayesian Networks.

pgmpy pgmpy is a python library for working with Probabilistic Graphical Models. Documentation and list of algorithms supported is at our official sit

pgmpy 2.2k Jan 3, 2023
Bayesian Optimization Library for Medical Image Segmentation.

bayesmedaug: Bayesian Optimization Library for Medical Image Segmentation. bayesmedaug optimizes your data augmentation hyperparameters for medical im

Şafak Bilici 7 Feb 10, 2022
Spearmint Bayesian optimization codebase

Spearmint Spearmint is a software package to perform Bayesian optimization. The Software is designed to automatically run experiments (thus the code n

Formerly: Harvard Intelligent Probabilistic Systems Group -- Now at Princeton 1.5k Dec 29, 2022
Python Environment for Bayesian Learning

Pebl is a python library and command line application for learning the structure of a Bayesian network given prior knowledge and observations. Pebl in

Abhik Shah 103 Jul 14, 2022
Python package for Bayesian Machine Learning with scikit-learn API

Python package for Bayesian Machine Learning with scikit-learn API Installing & Upgrading package pip install https://github.com/AmazaspShumik/sklearn

Amazasp Shaumyan 482 Jan 4, 2023
Simple, but essential Bayesian optimization package

BayesO: A Bayesian optimization framework in Python Simple, but essential Bayesian optimization package. http://bayeso.org Online documentation Instal

Jungtaek Kim 74 Dec 5, 2022
Bayesian dessert for Lasagne

Gelato Bayesian dessert for Lasagne Recent results in Bayesian statistics for constructing robust neural networks have proved that it is one of the be

Maxim Kochurov 84 May 11, 2020
A bare-bones TensorFlow framework for Bayesian deep learning and Gaussian process approximation

Aboleth A bare-bones TensorFlow framework for Bayesian deep learning and Gaussian process approximation [1] with stochastic gradient variational Bayes

Gradient Institute 127 Dec 12, 2022
Python package facilitating the use of Bayesian Deep Learning methods with Variational Inference for PyTorch

PyVarInf PyVarInf provides facilities to easily train your PyTorch neural network models using variational inference. Bayesian Deep Learning with Vari

null 342 Dec 2, 2022
Bayesian optimization in PyTorch

BoTorch is a library for Bayesian Optimization built on PyTorch. BoTorch is currently in beta and under active development! Why BoTorch ? BoTorch Prov

null 2.5k Dec 31, 2022
Safe Bayesian Optimization

SafeOpt - Safe Bayesian Optimization This code implements an adapted version of the safe, Bayesian optimization algorithm, SafeOpt [1], [2]. It also p

Felix Berkenkamp 111 Dec 11, 2022