PyXAB - Python X-Armed Bandit

PyPI version Documentation Status Code style: black testing github-PyXAB forks github-PyXAB stars downloads github-PyXAB license Code style: black

PyXAB is a Python open-source library for X-armed bandit algorithms, a prestigious set of optimizers for online black-box optimization and hyperparameter optimization.

Partition visualization

PyXAB includes implementations of different algorithms for X-armed bandit, such as Zooming, StoSOO, and HCT, and the most recent works such as GPO and VHCT. PyXAB also provides the most commonly-used synthetic objectives to evaluate the performance of different algorithms and the implementations for different hierarchical partitions

PyXAB is featured for:

  • User-friendly APIs, clear documentation, and detailed examples

  • Comprehensive library of optimization algorithms, partitions and synthetic objectives

  • High standard code quality and high testing coverage

  • Low dependency for flexible combination with other packages such as PyTorch, Scikit-Learn

Reminder: The algorithms are maximization algorithms!

Quick Example

PyXAB follows a natural and straightforward API design completely aligned with the online blackbox optimization paradigm. The following is a simple 6-line usage example.

First, we define the parameter domain and the algorithm to run. At every round t, call algo.pull(t) to get a point and call algo.receive_reward(t, reward) to give the algorithm the objective evaluation (reward)

domain = [[0, 1]]               # Parameter is 1-D and between 0 and 1
algo = T_HOO(rounds=1000, domain=domain)
for t in range(1000):
    point = algo.pull(t)
    reward = 1                  #TODO: User-defined objective returns the reward
    algo.receive_reward(t, reward)

Citations

If you use our package in your research or projects, we kindly ask you to cite our work

@misc{Li2023PyXAB,
    doi = {10.48550/ARXIV.2303.04030},
    url = {https://arxiv.org/abs/2303.04030},
    author = {Li, Wenjie and Li, Haoze and Honorio, Jean and Song, Qifan},
    title = {PyXAB -- A Python Library for $\mathcal{X}$-Armed Bandit and Online Blackbox Optimization Algorithms},
    publisher = {arXiv},
    year = {2023},
 }

We would appreciate it if you could cite our related works.

@article{li2023optimumstatistical,
    title={Optimum-statistical Collaboration Towards General and Efficient Black-box Optimization},
    author={Wenjie Li and Chi-Hua Wang and Guang Cheng and Qifan Song},
    journal={Transactions on Machine Learning Research},
    issn={2835-8856},
    year={2023},
    url={https://openreview.net/forum?id=ClIcmwdlxn},
    note={}
}
@misc{li2022Federated,
    doi = {10.48550/ARXIV.2205.15268},
    url = {https://arxiv.org/abs/2205.15268},
    author = {Li, Wenjie and Song, Qifan and Honorio, Jean and Lin, Guang},
    title = {Federated X-Armed Bandit},
    publisher = {arXiv},
    year = {2022},
}