Contextual Bandits

This is the documentation page for the python package contextualbandits. For more details, see the project’s GitHub page:

https://www.github.com/david-cortes/contextualbandits/

Installation

Package is available on PyPI, can be installed with

pip install contextualbandits

If it fails to install due to not being able to compile C code, an earlier pure-Python version can be installed with

pip install contextualbandits==0.1.8.5

Getting started

You can find user guides with detailed examples in the following links:

Online Contextual Bandits

Off policy Learning in Contextual Bandits

Policy Evaluation in Contextual Bandits

Online Contextual Bandits

Hint: if in doubt of where to start or which method to choose, the safest bet is BootstrappedUCB.

Policy classes - first one from each group is the recommended one to use:

ActiveExplorer

AdaptiveGreedy

BootstrappedTS

BootstrappedUCB

EpsilonGreedy

ExploreFirst

LinTS

LinUCB

LogisticTS

LogisticUCB

ParametricTS

PartitionedTS

PartitionedUCB

SeparateClassifiers

SoftmaxExplorer

Off-policy learning

Hint: if in doubt, use OffsetTree or SeparateClassifiers (last one is from the online module)

DoublyRobustEstimator

OffsetTree

Policy Evaluation

evaluateRejectionSampling

evaluateDoublyRobust

evaluateFullyLabeled

evaluateNCIS

Linear Regression

The package offers non-stochastic linear regression procedures with exact “partial_fit” solutions, which are recommended to use alongside the online policies for better incremental updates.

Linear Regression

ElasticNet

Indices and tables