mabwiser


Namemabwiser JSON
Version 2.7.4 PyPI version JSON
download
home_pagehttps://github.com/fidelity/mabwiser
SummaryMABWiser: Parallelizable Contextual Multi-Armed Bandits Library
upload_time2024-08-30 23:41:07
maintainerNone
docs_urlNone
authorFMR LLC
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements joblib numpy pandas scikit-learn scipy seaborn
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![ci](https://github.com/fidelity/mabwiser/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fidelity/mabwiser/actions/workflows/ci.yml) [![PyPI version fury.io](https://badge.fury.io/py/mabwiser.svg)](https://pypi.python.org/pypi/mabwiser/) [![PyPI license](https://img.shields.io/pypi/l/mabwiser.svg)](https://pypi.python.org/pypi/mabwiser/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![Downloads](https://static.pepy.tech/personalized-badge/mabwiser?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/mabwiser)

# MABWiser: Parallelizable Contextual Multi-Armed Bandits 

MABWiser ([IJAIT 2021](https://www.worldscientific.com/doi/10.1142/S0218213021500214), [ICTAI 2019](https://ieeexplore.ieee.org/document/8995418)) 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](https://www.python.org/dev/peps/pep-0008/), 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](https://fidelity.github.io/mabwiser).

## Bandit-based Recommender Systems
To solve personalized recommendation problems, MABWiser is integrated into our [Mab2Rec library](https://github.com/fidelity/mab2rec). 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](https://github.com/N-Wouda/ALNS). The ALNS library enables building metaheuristics for complex optimization problems, whereby MABWiser helps selecting the next best destroy, repair operation (arm).  

## Quick Start

```python
# 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](https://fidelity.github.io/mabwiser/installation.html).

## Support

Please submit bug reports and feature requests as [Issues](https://github.com/fidelity/mabwiser/issues).

## Citation

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

* **[IJAIT 2021]** [E. Strong,  B. Kleynhans, and S. Kadioglu, "MABWiser: Parallelizable Contextual Multi-Armed Bandits"](https://www.worldscientific.com/doi/abs/10.1142/S0218213021500214)
* **[ICTAI 2019]** [E. Strong,  B. Kleynhans, and S. Kadioglu, "MABWiser: A Parallelizable Contextual Multi-Armed Bandit Library for Python"](https://ieeexplore.ieee.org/document/8995418)

```bibtex
    @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](LICENSE).

## 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

<br>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fidelity/mabwiser",
    "name": "mabwiser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "FMR LLC",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/5e/05/1ee61041c3f73e0a0df945eda76f29fe6181443475bb9d5d95b4d453112c/mabwiser-2.7.4.tar.gz",
    "platform": null,
    "description": "[![ci](https://github.com/fidelity/mabwiser/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fidelity/mabwiser/actions/workflows/ci.yml) [![PyPI version fury.io](https://badge.fury.io/py/mabwiser.svg)](https://pypi.python.org/pypi/mabwiser/) [![PyPI license](https://img.shields.io/pypi/l/mabwiser.svg)](https://pypi.python.org/pypi/mabwiser/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![Downloads](https://static.pepy.tech/personalized-badge/mabwiser?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/mabwiser)\n\n# MABWiser: Parallelizable Contextual Multi-Armed Bandits \n\nMABWiser ([IJAIT 2021](https://www.worldscientific.com/doi/10.1142/S0218213021500214), [ICTAI 2019](https://ieeexplore.ieee.org/document/8995418)) 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. \n\nThe 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](https://www.python.org/dev/peps/pep-0008/), and is tested heavily. \n\nMABWiser is developed by the Artificial Intelligence Center of Excellence at Fidelity Investments. Documentation is available at [fidelity.github.io/mabwiser](https://fidelity.github.io/mabwiser).\n\n## Bandit-based Recommender Systems\nTo solve personalized recommendation problems, MABWiser is integrated into our [Mab2Rec library](https://github.com/fidelity/mab2rec). Mab2Rec enables building content- and context-aware recommender systems, whereby MABWiser helps selecting the next best item (arm).\n\n## Bandit-based Large-Neighborhood Search\nTo solve combinatorial optimization problems, MABWiser is integrated into [Adaptive Large Neighborhood Search](https://github.com/N-Wouda/ALNS). The ALNS library enables building metaheuristics for complex optimization problems, whereby MABWiser helps selecting the next best destroy, repair operation (arm).  \n\n## Quick Start\n\n```python\n# An example that shows how to use the UCB1 learning policy\n# to choose between two arms based on their expected rewards.\n\n# Import MABWiser Library\nfrom mabwiser.mab import MAB, LearningPolicy, NeighborhoodPolicy\n\n# Data\narms = ['Arm1', 'Arm2']\ndecisions = ['Arm1', 'Arm1', 'Arm2', 'Arm1']\nrewards = [20, 17, 25, 9]\n\n# Model \nmab = MAB(arms, LearningPolicy.UCB1(alpha=1.25))\n\n# Train\nmab.fit(decisions, rewards)\n\n# Test\nmab.predict()\n```\n\n## Available Bandit Policies\n\nAvailable Learning Policies:\n* Epsilon Greedy [1, 2]\n* LinGreedy [1, 2]\n* LinTS [3]. See [11] for a formal treatment of reproducibility in LinTS\n* LinUCB [4]\n* Popularity [2]\n* Random [2]\n* Softmax [2]\n* Thompson Sampling (TS) [5]\n* Upper Confidence Bound (UCB1) [2]\n\nAvailable Neighborhood Policies: \n* Clusters [6]\n* K-Nearest [7, 8]\n* LSH Nearest [9]\n* Radius [7, 8]\n* TreeBandit [10]\n\n## Installation\n\nMABWiser requires **Python 3.8+** and can be installed from PyPI using ``pip install mabwiser`` or by building from source as shown in [installation instructions](https://fidelity.github.io/mabwiser/installation.html).\n\n## Support\n\nPlease submit bug reports and feature requests as [Issues](https://github.com/fidelity/mabwiser/issues).\n\n## Citation\n\nIf you use MABWiser in a publication, please cite it as:\n\n* **[IJAIT 2021]** [E. Strong,  B. Kleynhans, and S. Kadioglu, \"MABWiser: Parallelizable Contextual Multi-Armed Bandits\"](https://www.worldscientific.com/doi/abs/10.1142/S0218213021500214)\n* **[ICTAI 2019]** [E. Strong,  B. Kleynhans, and S. Kadioglu, \"MABWiser: A Parallelizable Contextual Multi-Armed Bandit Library for Python\"](https://ieeexplore.ieee.org/document/8995418)\n\n```bibtex\n    @article{DBLP:journals/ijait/StrongKK21,\n      author    = {Emily Strong and Bernard Kleynhans and Serdar Kadioglu},\n      title     = {{MABWiser:} Parallelizable Contextual Multi-armed Bandits},\n      journal   = {Int. J. Artif. Intell. Tools},\n      volume    = {30},\n      number    = {4},\n      pages     = {2150021:1--2150021:19},\n      year      = {2021},\n      url       = {https://doi.org/10.1142/S0218213021500214},\n      doi       = {10.1142/S0218213021500214},\n    }\n\n    @inproceedings{DBLP:conf/ictai/StrongKK19,\n    author    = {Emily Strong and Bernard Kleynhans and Serdar Kadioglu},\n    title     = {MABWiser: {A} Parallelizable Contextual Multi-Armed Bandit Library for Python},\n    booktitle = {31st {IEEE} International Conference on Tools with Artificial Intelligence, {ICTAI} 2019, Portland, OR, USA, November 4-6, 2019},\n    pages     = {909--914},\n    publisher = {{IEEE}},\n    year      = {2019},\n    url       = {https://doi.org/10.1109/ICTAI.2019.00129},\n    doi       = {10.1109/ICTAI.2019.00129},\n    }\n```\n\n## License\n\nMABWiser is licensed under the [Apache License 2.0](LICENSE).\n\n## References\n\n1. John Langford and Tong Zhang. The epoch-greedy algorithm for contextual multi-armed bandits\n2. Volodymyr Kuleshov and Doina Precup. Algorithms for multi-armed bandit problems\n3. Agrawal, Shipra and Navin Goyal. Thompson sampling for contextual bandits with linear payoffs\n4. Chu, Wei, Li, Lihong, Reyzin Lev, and Schapire Robert. Contextual bandits with linear payoff functions\n5. Osband, Ian, Daniel Russo, and Benjamin Van Roy. More efficient reinforcement learning via posterior sampling\n6. Nguyen, Trong T. and Hady W. Lauw. Dynamic clustering of contextual multi-armed bandits\n7. Melody Y. Guan and Heinrich Jiang, Nonparametric stochastic contextual bandits\n8. Philippe Rigollet and Assaf Zeevi. Nonparametric bandits with covariates \n9. Indyk, Piotr, Motwani, Rajeev, Raghavan, Prabhakar, Vempala, Santosh. Locality-preserving hashing in multidimensional spaces\n10. Adam N. Elmachtoub, Ryan McNellis, Sechan Oh, Marek Petrik, A practical method for solving contextual bandit problems using decision trees\n11. Doruk Kilitcioglu, Serdar Kadioglu, Non-deterministic behavior of thompson sampling with linear payoffs and how to avoid it\n\n<br>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "MABWiser: Parallelizable Contextual Multi-Armed Bandits Library",
    "version": "2.7.4",
    "project_urls": {
        "Documentation": "https://fidelity.github.io/mabwiser/",
        "Homepage": "https://github.com/fidelity/mabwiser",
        "Source": "https://github.com/fidelity/mabwiser"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad85400f1740996be9afa3e2a84e96b77f1858d7025085d0441da988abc075da",
                "md5": "81b700845c00e3e3167a109cab7096f4",
                "sha256": "4ac5a5d2d959b55685248645675d5f84f7c620eba270925bf86edce8c5712b49"
            },
            "downloads": -1,
            "filename": "mabwiser-2.7.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "81b700845c00e3e3167a109cab7096f4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 61081,
            "upload_time": "2024-08-30T23:41:06",
            "upload_time_iso_8601": "2024-08-30T23:41:06.353420Z",
            "url": "https://files.pythonhosted.org/packages/ad/85/400f1740996be9afa3e2a84e96b77f1858d7025085d0441da988abc075da/mabwiser-2.7.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e051ee61041c3f73e0a0df945eda76f29fe6181443475bb9d5d95b4d453112c",
                "md5": "f9c01089262e319dfff6ff7d0369bc87",
                "sha256": "82055ada833cd81617e67c87630fc9895f05790ebe4679fdf6b1eafccdcf821c"
            },
            "downloads": -1,
            "filename": "mabwiser-2.7.4.tar.gz",
            "has_sig": false,
            "md5_digest": "f9c01089262e319dfff6ff7d0369bc87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 95370,
            "upload_time": "2024-08-30T23:41:07",
            "upload_time_iso_8601": "2024-08-30T23:41:07.852222Z",
            "url": "https://files.pythonhosted.org/packages/5e/05/1ee61041c3f73e0a0df945eda76f29fe6181443475bb9d5d95b4d453112c/mabwiser-2.7.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-30 23:41:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fidelity",
    "github_project": "mabwiser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "joblib",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.17.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "0.24.0"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    ">=",
                    "0.9.0"
                ]
            ]
        }
    ],
    "lcname": "mabwiser"
}
        
Elapsed time: 1.37762s