• Stars
    star
    203
  • Rank 191,829 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[IJAIT 2021] MABWiser: Contextual Multi-Armed Bandits Library

ci PyPI version fury.io PyPI license PRs Welcome Downloads

MABWiser: Parallelizable Contextual Multi-Armed Bandits

MABWiser (IJAIT 2021, ICTAI 2019) is a research library written in Python for rapid prototyping of multi-armed bandit algorithms. It supports context-free, parametric and non-parametric contextual bandit models and provides built-in parallelization for both training and testing components.

The library also provides a simulation utility for comparing different policies and performing hyper-parameter tuning. MABWiser follows a scikit-learn style public interface, adheres to PEP-8 standards, and is tested heavily.

MABWiser is developed by the Artificial Intelligence Center of Excellence at Fidelity Investments. Documentation is available at fidelity.github.io/mabwiser.

Bandit-based Recommender Systems

To solve personalized recommendation problems, MABWiser is integrated into our Mab2Rec library. Mab2Rec enables building content- and context-aware recommender systems, whereby MABWiser helps selecting the next best item (arm).

Bandit-based Large-Neighborhood Search

To solve combinatorial optimization problems, MABWiser is integrated into Adaptive Large Neighborhood Search. The ALNS library enables building metaheuristics for complex optimization problems, whereby MABWiser helps selecting the next best destroy, repair operation (arm).

Quick Start

# An example that shows how to use the UCB1 learning policy
# to choose between two arms based on their expected rewards.

# Import MABWiser Library
from mabwiser.mab import MAB, LearningPolicy, NeighborhoodPolicy

# Data
arms = ['Arm1', 'Arm2']
decisions = ['Arm1', 'Arm1', 'Arm2', 'Arm1']
rewards = [20, 17, 25, 9]

# Model 
mab = MAB(arms, LearningPolicy.UCB1(alpha=1.25))

# Train
mab.fit(decisions, rewards)

# Test
mab.predict()

Available Bandit Policies

Available Learning Policies:

  • Epsilon Greedy [1, 2]
  • LinGreedy [1, 2]
  • LinTS [3]. See [11] for a formal treatment of reproducibility in LinTS
  • LinUCB [4]
  • Popularity [2]
  • Random [2]
  • Softmax [2]
  • Thompson Sampling (TS) [5]
  • Upper Confidence Bound (UCB1) [2]

Available Neighborhood Policies:

  • Clusters [6]
  • K-Nearest [7, 8]
  • LSH Nearest [9]
  • Radius [7, 8]
  • TreeBandit [10]

Installation

MABWiser requires Python 3.8+ and can be installed from PyPI using pip install mabwiser or by building from source as shown in installation instructions.

Support

Please submit bug reports and feature requests as Issues.

Citation

If you use MABWiser in a publication, please cite it as:

    @article{DBLP:journals/ijait/StrongKK21,
      author    = {Emily Strong and Bernard Kleynhans and Serdar Kadioglu},
      title     = {{MABWiser:} Parallelizable Contextual Multi-armed Bandits},
      journal   = {Int. J. Artif. Intell. Tools},
      volume    = {30},
      number    = {4},
      pages     = {2150021:1--2150021:19},
      year      = {2021},
      url       = {https://doi.org/10.1142/S0218213021500214},
      doi       = {10.1142/S0218213021500214},
    }

    @inproceedings{DBLP:conf/ictai/StrongKK19,
    author    = {Emily Strong and Bernard Kleynhans and Serdar Kadioglu},
    title     = {MABWiser: {A} Parallelizable Contextual Multi-Armed Bandit Library for Python},
    booktitle = {31st {IEEE} International Conference on Tools with Artificial Intelligence, {ICTAI} 2019, Portland, OR, USA, November 4-6, 2019},
    pages     = {909--914},
    publisher = {{IEEE}},
    year      = {2019},
    url       = {https://doi.org/10.1109/ICTAI.2019.00129},
    doi       = {10.1109/ICTAI.2019.00129},
    }

License

MABWiser is licensed under the Apache License 2.0.

References

  1. John Langford and Tong Zhang. The epoch-greedy algorithm for contextual multi-armed bandits
  2. Volodymyr Kuleshov and Doina Precup. Algorithms for multi-armed bandit problems
  3. Agrawal, Shipra and Navin Goyal. Thompson sampling for contextual bandits with linear payoffs
  4. Chu, Wei, Li, Lihong, Reyzin Lev, and Schapire Robert. Contextual bandits with linear payoff functions
  5. Osband, Ian, Daniel Russo, and Benjamin Van Roy. More efficient reinforcement learning via posterior sampling
  6. Nguyen, Trong T. and Hady W. Lauw. Dynamic clustering of contextual multi-armed bandits
  7. Melody Y. Guan and Heinrich Jiang, Nonparametric stochastic contextual bandits
  8. Philippe Rigollet and Assaf Zeevi. Nonparametric bandits with covariates
  9. Indyk, Piotr, Motwani, Rajeev, Raghavan, Prabhakar, Vempala, Santosh. Locality-preserving hashing in multidimensional spaces
  10. Adam N. Elmachtoub, Ryan McNellis, Sechan Oh, Marek Petrik, A practical method for solving contextual bandit problems using decision trees
  11. Doruk Kilitcioglu, Serdar Kadioglu, Non-deterministic behavior of thompson sampling with linear payoffs and how to avoid it

More Repositories

1

kconnect

Kubernetes Connection Manager CLI
Go
196
star
2

spock

spock is a framework that helps manage complex parameter configurations during research and development of Python applications
Python
118
star
3

mab2rec

[AAAI 2024] Mab2Rec: Multi-Armed Bandits Recommender
Jupyter Notebook
113
star
4

seq2pat

[AAAI 2022] Seq2Pat: Sequence-to-Pattern Generation Library
Python
110
star
5

kraan

Kraan is a Kubernetes Controller that manages the deployment of HelmReleases to a cluster.
Go
91
star
6

awsrun

CLI and library to execute commands over one or more AWS or Azure accounts concurrently.
Python
78
star
7

stoke

A lightweight wrapper for PyTorch that provides a simple declarative API for context switching between devices, distributed modes, mixed-precision, and PyTorch extensions.
Python
65
star
8

selective

[CPAIOR 2021] Selective: Feature Selection Library
Python
59
star
9

sim2real-docs

Synthesize image datasets of documents in natural scenes with Python+Blender3D
Python
56
star
10

textwiser

[AAAI 2021] TextWiser: Text Featurization Library
Python
50
star
11

jurity

[ICMLA 2021] Jurity: Fairness & Evaluation Library
Python
42
star
12

vbc-desktop

Python
15
star
13

theliv

Go
10
star
14

classitransformers

A abstract text classification library using language models. Build your fine-tuned text classifier in 5 steps.
Jupyter Notebook
9
star
15

BoolXAI

BoolXAI is a research library for machine learning for Explainable AI (XAI) based on expressive Boolean formulas.
Jupyter Notebook
4
star
16

easyimputer

An abstract missing value imputation library. EasyImputer employs the right kind of imputation technique based on the statistics of missing data.
Python
4
star
17

homebrew-tap

Allow for homebrew based installation of Fidelity authored works before they are ready for homebrew-core
Ruby
3
star
18

vbc-board

Python
3
star
19

PhraseExtraction

An abstract python library to extract key phrases from text document.
Jupyter Notebook
3
star
20

krew-index

1
star