Package: bore
BORE: Bayesian Optimization as Density-Ratio EstimationA minimalistic implementation of BORE: Bayesian Optimization as Density-Ratio Estimation[1]in Python 3 and TensorFlow 2.Getting StartedInstall withpip:$pipinstall"bore[tf]"With support for GPU accelaration:$pipinstall"bore[tf-gpu]"With support for HpBandSter plugin:$pipinstall"bore[tf,hpbandster]"Usage/ExamplesThis example implements an instantiation of BORE based on a multi-layer perceptron (i.e. a fully-connected feed-forward neural network) classifier.First we build and compile the classifier model usingMaximizableSequential:frombore.modelsimportMaximizableSequentialfromtensorflow.keras.layersimportDense# build modelclassifier=MaximizableSequential()classifier.add(Dense(16,activation="relu"))classifier.add(Dense(16,activation="relu"))classifier.add(Dense(1,activation="sigmoid"))# compile modelclassifier.compile(optimizer="adam",loss="binary_crossentropy")This syntax should be familiar to anyone who has used a high-level neural network library such as Keras. In fact,MaximizableSequentialis simply a subclass of theSequentialclass from Keras. More specifically, in addition to inheriting the usual functionalities, it provides theargmaxmethod which finds the input at which the network output is maximized.Using this method, the standard optimization loop can be implemented as follows:importnumpyasnpfeatures=[]targets=[]# initial designfeatures.extend(features_init)targets.extend(targets_init)foriinrange(num_iterations):# construct classification problemX=np.vstack(features)y=np.hstack(targets)tau=np.quantile(y,q=0.25)z=np.less(y,tau)# update classifierclassifier.fit(X,z,epochs=200,batch_size=64)# suggest new candidatex_next=classifier.argmax(method="L-BFGS-B",num_start_points=3,bounds=bounds)# evaluate blackbox functiony_next=blackbox.evaluate(x_next)# update datasetfeatures.append(x_next)targets.append(y_next)For complete end-to-end scripts and to reproduce our results, take a look at the associatedexperimentsrepository.FeaturesBORE-MLP: BORE based on a multi-layer perceptron (MLP) classifierProvides higher-order functions that leverage automatic differentiation to transform Keras models into functions that can easily be optimized by methods in SciPy, not least multi-started quasi-Newton hill-climbing methods such as L-BFGS.RoadmapIntegration with theOptunaframework by implementing aSamplerplugin.AuthorsLead Developers:Louis TiaoAaron Kleinhttps://tiao.io/https://aaronkl.github.io/Reference[1]L. Tiao, A. Klein, C. Archambeau, E. V. Bonilla, M. Seeger, and F. Ramos.BORE: Bayesian Optimization by Density-Ratio Estimation.
In Proceedings of the 38th International Conference on Machine Learning (ICML2021),
Virtual (Online), July 2021.Cite:@inproceedings{tiao2021-bore,
  title={{B}ayesian {O}ptimization by {D}ensity-{R}atio {E}stimation},
  author={Tiao, Louis and Klein, Aaron and Archambeau, C\'{e}dric and Bonilla, Edwin V and Seeger, Matthias and Ramos, Fabio},
  booktitle={Proceedings of the 38th International Conference on Machine Learning (ICML2021)},
  address={Virtual (Online)},
  year={2021},
  month={July}
}LicenseMIT LicenseCopyright (c) 2021, Louis C. TiaoPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.History0.1.0 (2019-12-27)First release on PyPI.