Package: aalto-boss
Bayesian Optimization Structure Search (BOSS) is a general-purpose Bayesian Optimization code. It is designed to facilitate machine learning in computational and experimental natural sciences.For a more detailed description of the code and tutorials, please consult theuser guide.InstallationBOSS is distributed as a PyPI package and can be installed using pip:python3 -m pip install aalto-bossWe recommend installing BOSS inside a virtual environment (venv,conda…). If you are not using virtual environments, we recommend performing a user-installation instead:python3 -m pip install --user aalto-bossBasic usageAs an easy example, consider the optimization of a bounded 1D function. BOSS can be run either directly from Python or via a CLI interface, both these approaches are illustrated briefly below. Note that BOSS always minimizes a given function.Python iterfaceTo run BOSS from Python we first define our objective function, by default BOSS expects this function to take a single 2D numpy array as argument (this behaviour can be modified) and return a scalar value. Next, we import theBOMainobject and feed it the function plus any number of BOSS keywords, after which the optimization can be started. Once finished, the optimziation results are returned in aBOResultsobject.""" Using BOSS to solve the minimization problem
f(x) = sin(x) + 1.5*exp(-(x-4.3)**2) , 0 < x < 7
"""importnumpyasnpfromboss.bo.bo_mainimportBOMainfromboss.pp.pp_mainimportPPMaindeffunc(X):""" BOSS-compatible definition of the function. """x=X[0,0]returnnp.sin(x)+1.5*np.exp(-(x-4.3)**2)if__name__=='__main__':bo=BOMain(func,np.array([[0.,7.]]),# boundskernel='rbf',initpts=5,iterpts=15,)res=bo.run()# print global minimum value and location from the last iterationprint(res.select('mu_glmin',-1),res.select('x_glmin',-1))# run BOSS post-processing# creates a folder "postprocessing" with plots and datapp=PPMain(res,pp_models=True,pp_acq_funcs=True)pp.run()Command-line iterfaceThe CLI is provided by an executable calledboss. The user must provide an input file containing a list of BOSS keywords and a separate Python script that defines a function to be optimized. By default, BOSS expects this function to take a single 2D numpy array as argument (this behaviour can be modified) and return a scalar value. Below we define such a function in a Python script, arbitrarily nameduser_function.py:""" user_function.py
This script contains the function definition for the minimization problem
f(x) = sin(x) + 1.5*exp(-(x-4.3)**2) ,  0 < x < 7
Note that the bounds are specified in the BOSS input file.
"""importnumpyasnpdeffunc(X):""" BOSS-compatible definition of the function. """x=X[0,0]returnnp.sin(x)+1.5*np.exp(-(x-4.3)**2)To minimize this function subject to the constraint0 < x < 7, we define a BOSS input fileboss.in:# boss.inuserfnuser_function.pyfuncbounds07yrange-11kernelrbfinitpts5iterpts15The optimization (including post-processing) can now be started from the command line:$bossopboss.inCreditsBOSS is under active development in theMaterials Informatics Laboratoryat the University of Turku and theComputational Electronic Structure Theory (CEST) groupat Aalto University. Past and present members of development team includeVille ParkkinenHenri PaulamäkiArttu TolvanenUlpu RemesNuutti StenEmma LehtoTuomas RossiManuel KuchelmeisterMikael GranitRansell D’souzaArmi TiihonenMatthias StosiekJoakim Löfgren (maintainer)Milica Todorović (team lead)If you wish to use BOSS in your research, please citeMilica Todorovic, Micheal U. Gutmann, Jukka Corander, and Patrick RinkeBayesian inference of atomistic structure in functional materialsnpj Comput Mater5, 35 (2019)doi: 10.1038/s41524-019-0175-2Issues and feature requestsIt is strongly encouraged to submit bug reports, questions, and feature requests via thegitlab issue tracker.
The BOSS development team can be contacted by email atmilica.todorovic@utu.fi