Package: ax-platform
Ax is an accessible, general-purpose platform for understanding, managing,
deploying, and automating adaptive experiments.Adaptive experimentation is the machine-learning guided process of iteratively
exploring a (possibly infinite) parameter space in order to identify optimal
configurations in a resource-efficient manner. Ax currently supports Bayesian
optimization and bandit optimization as exploration strategies. Bayesian
optimization in Ax is powered byBoTorch,
a modern library for Bayesian optimization research built on PyTorch.For full documentation and tutorials, see theAx websiteWhy Ax?Versatility: Ax supports different kinds of experiments, from dynamic ML-assisted A/B testing, to hyperparameter optimization in machine learning.Customization: Ax makes it easy to add new modeling and decision algorithms, enabling research and development with minimal overhead.Production-completeness: Ax comes with storage integration and ability to fully save and reload experiments.Support for multi-modal and constrained experimentation: Ax allows for running and combining multiple experiments (e.g. simulation with a real-world "online" A/B test) and for constrained optimization (e.g. improving classification accuracy without significant increase in resource-utilization).Efficiency in high-noise setting: Ax offers state-of-the-art algorithms specifically geared to noisy experiments, such as simulations with reinforcement-learning agents.Ease of use: Ax includes 3 different APIs that strike different balances between lightweight structure and flexibility. Using the most concise Loop API, a whole optimization can be done in just one function call. The Service API integrates easily with external schedulers. The most elaborate Developer API affords full algorithm customization and experiment introspection.Getting StartedTo run a simple optimization loop in Ax (using theBooth response surfaceas the
artificial evaluation function):>>>fromaximportoptimize>>>best_parameters,best_values,experiment,model=optimize(parameters=[{"name":"x1","type":"range","bounds":[-10.0,10.0],},{"name":"x2","type":"range","bounds":[-10.0,10.0],},],# Booth functionevaluation_function=lambdap:(p["x1"]+2*p["x2"]-7)**2+(2*p["x1"]+p["x2"]-5)**2,minimize=True,)# best_parameters contains {'x1': 1.02, 'x2': 2.97}; the global min is (1, 3)InstallationRequirementsYou need Python 3.9 or later to run Ax.The required Python dependencies are:botorchjinja2pandasscipysklearnplotly >=2.2.1Stable VersionInstalling via pipWe recommend installing Ax via pip (even if using Conda environment):conda install pytorch torchvision -c pytorch  # OSX only (details below)
pip install ax-platformInstallation will use Python wheels from PyPI, available forOSX, Linux, and Windows.Note: Make sure thepipbeing used to installax-platformis actually the one from the newly created Conda environment.
If you're using a Unix-based OS, you can usewhich pipto check.Recommendation for MacOS users: PyTorch is a required dependency of BoTorch, and can be automatically installed via pip.
However,we recommend youinstall PyTorch manuallybefore installing Ax, using the Anaconda package manager.
Installing from Anaconda will link against MKL (a library that optimizes mathematical computation for Intel processors).
This will result in up to an order-of-magnitude speed-up for Bayesian optimization, as at the moment, installing PyTorch from pip does not link against MKL.If you need CUDA on MacOS, you will need to build PyTorch from source. Please consult the PyTorch installation instructions above.Optional DependenciesTo use Ax with a notebook environment, you will need Jupyter. Install it first:pip install jupyterIf you want to store the experiments in MySQL, you will need SQLAlchemy:pip install SQLAlchemyLatest VersionInstalling from GitYou can install the latest (bleeding edge) version from Git.First, see recommendation for installing PyTorch for MacOS users above.At times, the bleeding edge for Ax can depend on bleeding edge versions of BoTorch (or GPyTorch). We therefore recommend installing those from Git as well:pip install git+https://github.com/cornellius-gp/linear_operator.git
pip install git+https://github.com/cornellius-gp/gpytorch.git
export ALLOW_LATEST_GPYTORCH_LINOP=true
pip install git+https://github.com/pytorch/botorch.git
export ALLOW_BOTORCH_LATEST=true
pip install git+https://github.com/facebook/Ax.git#egg=ax-platformOptional DependenciesIf using Ax in Jupyter notebooks:pip install git+https://github.com/facebook/Ax.git#egg=ax-platform[notebook]To support plotly-based plotting in newer Jupyter notebook versionspip install "notebook>=5.3" "ipywidgets==7.5"See Plotly repo's READMEfor details and JupyterLab instructions.If storing Ax experiments via SQLAlchemy in MySQL or SQLite:pip install git+https://github.com/facebook/Ax.git#egg=ax-platform[mysql]Join the Ax CommunityGetting helpPlease open an issue on ourissues pagewith any questions, feature requests or bug reports! If posting a bug report, please include a minimal reproducible example (as a code snippet) that we can use to reproduce and debug the problem you encountered.ContributingSee theCONTRIBUTINGfile for how to help out.When contributing to Ax, we recommend cloning therepositoryand installing all optional dependencies:pip install git+https://github.com/cornellius-gp/linear_operator.git
pip install git+https://github.com/cornellius-gp/gpytorch.git
export ALLOW_LATEST_GPYTORCH_LINOP=true
pip install git+https://github.com/pytorch/botorch.git
export ALLOW_BOTORCH_LATEST=true
git clone https://github.com/facebook/ax.git --depth 1
cd ax
pip install -e .[tutorial]See recommendation for installing PyTorch for MacOS users above.The above example limits the cloned directory size via the--depthargument togit clone. If you require the entire commit history you may remove this
argument.LicenseAx is licensed under theMIT license.