Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Bayesian Optimization of Combinatorial Structures

License

NotificationsYou must be signed in to change notification settings

baptistar/BOCS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is the BOCS algorithm?

The BOCS algorithm is a method for finding a global minimizer of an expensive-to-evaluate black-box function that is defined over discrete inputs given a finite budget of function evaluations. The algorithm combines an adaptive generative model and semidefinite programming techniques for scalability of the acquisition function to large combinatorial domains. For more information on the details of the algorithm, please see theICML paper.

Authors

Ricardo Baptista (MIT) and Matthias Poloczek (University of Arizona)

E-mails:rsb@mit.edu,poloczek@email.arizona.edu

Installation

The BOCS algorithm is implemented in MATLAB and only requires theCVX package to be available in the local path for performing convex optimization. The scripts for comparing to other discrete optimization methods require an installation ofSMAC, the python wrapperpySMAC and thebayesopt function in MATLAB for Bayesian Optimization with the Expected Improvement acquisition function.

A python implementation of the BOCS algorithm is also available in the BOCSpy folder. The code has been tested with Python 2.7 and 3.5 and requires thecvxpy andcvxopt packages.

Example running BOCS on a benchmark problem

We provide an example for running the BOCS algorithm the Ising model sparsification benchmark problem on a 9-node grid graph with a budget of 100 sample evaluations. The code can also be run from MATLAB using the filescripts/example_ising.m.

The script first defines the input parameters in theinputs struct. These include the number of discrete variables (i.e., edges in the grid graph)n_vars, the sample evaluation budgetevalBudget, the number of samples initially used to build the statistical modeln_init, the lambda parameterlambda, and the horseshoeestimator used for the regression model. Other options forestimator are bayes and mle.

inputs=struct;inputs.n_vars=12;inputs.evalBudget=100;inputs.n_init=20;inputs.lambda=1e-4;inputs.estimator='horseshoe';

We randomly instantiate the edge weights of the Ising model and define the objective function based on the KL divergence ininputs.model. We add an l_1 penalty scaled by the lambda parameter ininputs.penalty.

% Generate random graphical modelTheta= rand_ising_grid(9);Moments= ising_model_moments(Theta);% Save objective function and regularization terminputs.model= @(x) KL_divergence_ising(Theta,Moments,x);inputs.penalty= @(x)inputs.lambda*sum(x,2);

We sample the initial values for the statistical model and evaluate the objective function at these samples. Using these inputs, we run the BOCS-SA and BOCS-SDP algorithms with the order 2 regression model.

% Generate initial samples for statistical modelsinputs.x_vals= sample_models(inputs.n_init,inputs.n_vars);inputs.y_vals=inputs.model(inputs.x_vals);% Run BOCS-SDP and BOCS-SA (order 2)B_SA= BOCS(inputs.model,inputs.penalty,inputs,2,'SA');B_SDP= BOCS(inputs.model,inputs.penalty,inputs,2,'sdp');

We also provide an example of running the python implementation of BOCS on the binary quadratic programming benchmark problem. The code can be run using the commandpython BOCSpy/example_bqp.py. The script produces a plot with the convergence results from running BOCS-SA and BOCS-SDP on an instance of the problem.

Comparison to other discrete optimization algorithms

To compare BOCS to other algorithms, we provided files in the scripts folder that run all cases for the quadratic programming problem, the Ising model sparsification problem, and the contamination control problem. The algorithms that are compared include:

To run these examples, we provided three files in the scripts folder namedopt_runs_quad,opt_runs_ising andopt_runs_cont for the benchmark problems. In each of the files, then_func parameter defines multiple random instances of the test function and then_runs parameter defines the number of repeated evaluations of each algorithm starting from different initial datasets. Then_proc parameter can be used to specify the number of available processors to parallelize the execution of these tests. Lastly, runningscripts/create_plots will plot the average output of these tests and present statistics of the solutions found by all algorithms, while runningscripts/cross_validate followed byscripts/plot_crossval can be used to validate the statistical models for each benchmark problem.


[8]ページ先頭

©2009-2025 Movatter.jp