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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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