Skip to main content

NeuralBandit

This WIP repository reproduces the experiments of the NeuralBandit and BanditForest papers. The code of BanditForest is available here.

Table of contents

TODO List

  • Doing the requirements.txt

  • Automating the run of experiments

  • NeuralBandit Paper

    • Implementation of NeuralBandit.A and .B
    • Adding concept drift to the Game
  • BanditForest Paper

    • Adding Census et Adult dataset
    • Adding Noise to the reward

Steps to reproduce

from neuralbandit import get_cov_dataset, ContextualBanditGame, NeuralBandit
from neuralbandit.sota import RandomBandit, BanditTron, LinUCB

dataset = get_cov_dataset()

cumulative_reward = 0
T = int(2.5E6)

game = ContextualBanditGame(dataset, T)
#player = RandomBandit(dataset.K)
#player = LinUCB(dataset.K, dataset.D)
player = NeuralBandit(dataset.K, dataset.D, layer_count = 1, layer_size = 64, gamma = 0.05)

for t in tqdm(range(T)):
        context = game.get_context()
        action = player.select(context)
        reward = game.play(action)
        
        cumulative_reward += reward
        
        player.observe(action, context, reward)

cumulative_regret = (T*game.optimal_accuracy - cumulative_reward)
print(cumulative_regret)

Citations

NeuralBandit

@InProceedings{10.1007/978-3-319-12637-1_47,
author="Allesiardo, Robin
and F{\'e}raud, Rapha{\"e}l
and Bouneffouf, Djallel",
editor="Loo, Chu Kiong
and Yap, Keem Siah
and Wong, Kok Wai
and Teoh, Andrew
and Huang, Kaizhu",
title="A Neural Networks Committee for the Contextual Bandit Problem",
booktitle="Neural Information Processing",
year="2014",
publisher="Springer International Publishing",
address="Cham",
pages="374--381",
abstract="This paper presents a new contextual bandit algorithm, NeuralBandit, which does not need hypothesis on stationarity of contexts and rewards. Several neural networks are trained to modelize the value of rewards knowing the context. Two variants, based on multi-experts approach, are proposed to choose online the parameters of multi-layer perceptrons. The proposed algorithms are successfully tested on a large dataset with and without stationarity of rewards.",
isbn="978-3-319-12637-1"
}

BanditForest

@InProceedings{pmlr-v51-feraud16,
  title = 	 {Random Forest for the Contextual Bandit Problem},
  author = 	 {Raphaël Féraud and Robin Allesiardo and Tanguy Urvoy and Fabrice Clérot},
  booktitle = 	 {Proceedings of the 19th International Conference on Artificial Intelligence and Statistics},
  pages = 	 {93--101},
  year = 	 {2016},
  editor = 	 {Arthur Gretton and Christian C. Robert},
  volume = 	 {51},
  series = 	 {Proceedings of Machine Learning Research},
  address = 	 {Cadiz, Spain},
  month = 	 {09--11 May},
  publisher = 	 {PMLR},
  pdf = 	 {http://proceedings.mlr.press/v51/feraud16.pdf},
  url = 	 {http://proceedings.mlr.press/v51/feraud16.html},
  abstract = 	 {To address the contextual bandit problem, we propose an online random forest algorithm. The analysis of the proposed algorithm is based on the sample complexity needed to find the optimal decision stump. Then, the decision stumps are recursively stacked in a random collection of decision trees, BANDIT FOREST. We show that the proposed algorithm is optimal up to logarithmic factors. The dependence of the sample complexity upon the number of contextual variables is logarithmic. The computational cost of the proposed algorithm with respect to the time horizon is linear. These analytical results allow the proposed algorithm to be efficient in real applications , where the number of events to process is huge, and where we expect that some contextual variables, chosen from a large set, have potentially non-linear dependencies with the rewards. In the experiments done to illustrate the theoretical analysis, BANDIT FOREST obtain promising results in comparison with state-of-the-art algorithms.}
}

Metadata

Release files for neuralbandit 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neuralbandit 0.1.2
File Size Uploaded Provenance Actions
neuralbandit-0.1.2.tar.gz 7.7 kB Without provenance Details for neuralbandit-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neuralbandit 0.1.2
File Interpreter ABI Platform Actions
neuralbandit-0.1.2-py3-none-any.whl Python 3 none any Details for neuralbandit-0.1.2-py3-none-any.whl

Total release size: 15.8 kB

Release files / neuralbandit-0.1.2.tar.gz

Download URL neuralbandit-0.1.2.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
67aa1dd503f0eb5b29a4de6565aad721eebc637611383f2a2fd9ee7be6b81c55
BLAKE2b-256 checksum
How to use checksums
7a6ee2e71bb145af4440c2042cfe9fcecb01d5d90bd65299705710ead6f53750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.2 CPython/3.7.3 Windows/10

Release files / neuralbandit-0.1.2-py3-none-any.whl

Download URL neuralbandit-0.1.2-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6164e86d2f5e59716e568cb82701ef74affd447dd1e573f527083e193c9715ce
BLAKE2b-256 checksum
How to use checksums
9621e2fbba46d6665eb99171dabd782ae54dabb62023b8ded81f47deb13d1f45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.2 CPython/3.7.3 Windows/10

Security for neuralbandit 0.1.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page