Skip to main content

Python code from the book Bandit Algorithms for Website Optimization

Project description

Bandit Code for the Book "Reinforcement Learning"

This repository was forked from John Myles White's "BanditsBook" repository.

I have removed all the non-python code and added a setup.py file to allow for pip installs. Everything else is the same.

Installing

pip install banditsbook

Getting Started

from arms.bernoulli import BernoulliArm
from testing_framework.tests import test_algorithm
from algorithms.epsilon_greedy.standard import EpsilonGreedy
num_sims = 1000
horizon = 10

arm0 = BernoulliArm(0.2)
arm1 = BernoulliArm(0.2)
arms = [arm0, arm1]
algo1 = EpsilonGreedy(0.1, [], [])
sim_nums, times, chosen_arms, rewards, cumulative_rewards = test_algorithm(
    algo1, arms, num_sims, horizon)
print(rewards)

See the original repository for more information: https://github.com/johnmyleswhite/BanditsBook

Icons made by Good Ware from www.flaticon.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

banditsbook-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

banditsbook-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file banditsbook-0.1.1.tar.gz.

File metadata

  • Download URL: banditsbook-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for banditsbook-0.1.1.tar.gz
Algorithm Hash digest
SHA256 76f1e78ebf8a18c07924dc2e64924727c6028a0a7fe5e45928886adbf85b9554
MD5 ad72329613ccd23ddf97e5ed0cdc6356
BLAKE2b-256 409c9f1c5654bf1f4d71c8ec594e2d99bbe80451e3dc7a1918a587dc6766fa32

See more details on using hashes here.

File details

Details for the file banditsbook-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: banditsbook-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for banditsbook-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54040cad53012ddfd5fabc1e6afcdd40c7ee1201e8868339528dccc8ce1f089f
MD5 aadffebac65cdcf026688c6b7037a9fb
BLAKE2b-256 68c0afdf81ebc086acae3f536424922716a1f2fa8a45fec573e6a62e0d01136f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page