Build Status
pulpo
A library and sdk for non-contextual and contextual Multi-Armed-Bandit (MAB) algorithms for multiple use cases. The sdk version enables you to deploy it on AWS.
Installation
Prerequisites
pulpo requires Python 3.6+
Install pulpo
At the command line:
pip install pulpo
How To
Library
Pulpo can be used as a library to instantiate and run online MABs. The core of the library are the bandit implementations under pulpo/badnits module. The super class of them is OnlineBandit if you wish to implement your own MAB implementation.
Currently, the following MAB implementations are available:
- Epsilon Greedy (
EGreedy)
The usage of this library starts from Pulpo class. For example, let's say that we want to run 1 online bandit with 3 arms using EGreedy, then:
from pulpo.bandits.dataclasses import EpsilonGreedyArm
from pulpo.bandits.epsilon_greedy import EGreedy
from pulpo.pulpo import Pulpo
arm_names = ["article1", "article2", "article3"]
arms = [EpsilonGreedyArm(name, 1, 0) for name in arm_names] # priors for n=1 and sum=0, i.e. steps and total reward so far
bandit = EGreedy("article_recommendation", arms, epsilon=0.9)
pulpo = Pulpo([bandit]) # Instantiate Pulpo
arm_id = pulpo.choose(bandit.bandit_id) # to get an arm decision
# get some feedback for the arm decision and pass it to back
feedback = 1.0
pulpo.update(bandit.bandit_id, arm_id, feedback)
Alternatively, the Pulpo class can be instantiated in the following manner:
import json
from pulpo.pulpo import Pulpo
bandit_id = "article_recommendation"
config = config = [{"bandit_id": bandit_id, "bandit_type": "epsilon_greedy", "arm_ids": ["article1", "article2", "article3"]}]
pulpo = Pulpo.make_from_json(json.dumps(config)) # Instantiate Pulpo
arm_id = pulpo.choose(bandit_id) # to get an arm decision
# get some feedback for the arm decision and pass it to back
feedback = 1.0
pulpo.update(bandit_id, arm_id, feedback)
AWS SDK
Pulpo can be used as an sdk to deploy and run MABs on AWS. Soon...
Metadata
Release files for pulpo 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pulpo-0.0.1.tar.gz | 7.6 kB | Without provenance | Details for pulpo-0.0.1.tar.gz |
Release files / pulpo-0.0.1.tar.gz
| Download URL | pulpo-0.0.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c903c22c25e47f88b91e1710a1ff516d5b2d8bb10f7ad159ed85a3542401be6b
|
|
BLAKE2b-256 checksum How to use checksums |
ddda105c2d5795a1d28a38e0fbec6d146d7a68a324c9a2b0f8f827e7d791fdae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
|
Security for pulpo 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.