Skip to content

Commit

Permalink
Renew Documentation
Browse files Browse the repository at this point in the history
 ### Changes
 * Removed all rst files, and replaced with matching md files.
 * Add md extension on conf.py.
 * Edited api and fullapi files with relevant content.
 * Added Shahar Bar to authors.
 * Edited tutorial jupyter notebooks.
 * Updated README.md content.
 * Removed make.bat due to redundancy.
 * Edited makefile to clean before build.
 * Added PyPi classifiers on pyproject.toml.
 * Moved html outputs of make under docs/build/html.
 * Added acronyms.md.
 * Added continuous_documentation.yml to continuously update documentation.
  • Loading branch information
Shahar-Bar committed Sep 29, 2024
1 parent cddda5c commit 7ee2dbf
Show file tree
Hide file tree
Showing 104 changed files with 592 additions and 22,000 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/continuous_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Documentation

on:
push:
branches:
- main # Rebuild docs on changes to the main branch

jobs:
build-docs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8' # Specify the Python version needed for your environment

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.poetry/bin:$PATH"
- name: Install project dependencies with Poetry
run: |
poetry install
- name: Build HTML docs
run: |
cd docs/src
make html # Build the HTML documentation
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ repos:
- repo: https://github.com/fastai/nbdev
rev: 2.3.11
hooks:
- id: nbdev_clean
- id: nbdev_clean
8 changes: 8 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Authors

- Dario d'Andrea, <mailto:[email protected]>
- Shahar Bar, <mailto:[email protected]>
- Jerome Carayol, <mailto:[email protected]>
- Stefano Piazza, <mailto:[email protected]>
- Raphael Steinmann, <mailto:[email protected]>
- Armand Valsesia, <mailto:[email protected]>
9 changes: 0 additions & 9 deletions AUTHORS.rst

This file was deleted.

7 changes: 2 additions & 5 deletions CHANGELOG.rst → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
=========
Changelog
=========
# Changelog

Version 0.0.1
=============
## Version 0.0.1

- Add stochastic Multi-Armed Bandit (sMAB)
- Add Contextual Multi-Armed Bandit (cMAB)
Expand Down
64 changes: 27 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ Installation
------------

This library is distributed on [PyPI](https://pypi.org/project/pybandits/) and can be installed with ``pip``.
The latest release is version ``0.0.2``. ``pybandits`` requires a Python version ``>= 3.8``.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
pip install pybandits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The command above will automatically install all the dependencies listed in ``requirements.txt``. Please visit the
Based on the guidelines of ``pymc3`` authors, it is highly recommended to install the library in a conda environment via the following.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
conda install -c conda-forge pymc3
pip install pybandits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The command above will automatically install all the dependencies listed in ``pyproject.toml``. Please visit the
[installation](https://playtikaoss.github.io/pybandits/installation.html)
page for more details.

Expand All @@ -32,24 +38,26 @@ A short example, illustrating it use. Use the sMAB model to predict actions and

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~python
import numpy as np
import random
from pybandits.core.smab import Smab
from pybandits.model import Beta
from pybandits.smab import SmabBernoulli

# init stochastic Multi-Armed Bandit model
smab = Smab(action_ids=['Action A', 'Action B', 'Action C'])
n_samples=100

# predict actions
pred_actions, _ = smab.predict(n_samples=100)
# define action model
actions = {
"a1": Beta(),
"a2": Beta(),
}

n_successes, n_failures = {}, {}
for a in set(pred_actions):
# init stochastic Multi-Armed Bandit model
smab = SmabBernoulli(actions=actions)

# simulate rewards from environment
n_successes[a] = random.randint(0, pred_actions.count(a))
n_failures[a] = pred_actions.count(a) - n_successes[a]
# predict actions
pred_actions, _ = smab.predict(n_samples=n_samples)
simulated_rewards = np.random.randint(2, size=n_samples)

# update model
smab.update(action_id=a, n_successes=n_successes[a], n_failures=n_failures[a])
# update model
smab.update(actions=pred_actions, rewards=simulated_rewards)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Documentation
Expand All @@ -63,41 +71,23 @@ and
Info for developers
-------------------

PyBandits is supported by the [AI for gaming and entertainment apps](https://www.meetup.com/ai-for-gaming-and-entertainment-apps/) community.

The source code of the project is available on [GitHub](https://github.com/playtikaoss/pybandits).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
git clone https://github.com/playtikaoss/pybandits.git
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can install the library and the dependencies with one of the following commands:
You can install the library and the dependencies from the source code with one of the following commands:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
pip install . # install library + dependencies
pip install .[develop] # install library + dependencies + developer-dependencies
pip install -r requirements.txt # install dependencies
pip install -r requirements-dev.txt # install developer-dependencies
poetry install # install library + dependencies
poetry install --without dev # install library + dependencies, excluding developer-dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As suggested by the authors of ``pymc3`` and ``pandoc``, we highly recommend to install these dependencies with
``conda``:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
conda install -c conda-forge pandoc
conda install -c conda-forge pymc3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To create the file ``pybandits.whl`` for the installation with ``pip`` run the following command:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
python setup.py sdist bdist_wheel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To create the HTML documentation run the following commands:

~~~~~~~~~~~bash
cd docs
cd docs/src
make html
~~~~~~~~~~~

Expand Down
Empty file removed docs/.nojekyll
Empty file.
Binary file removed docs/_images/cmab.png
Binary file not shown.
Binary file removed docs/_images/smab.png
Binary file not shown.
22 changes: 0 additions & 22 deletions docs/_sources/api.rst.txt

This file was deleted.

3 changes: 0 additions & 3 deletions docs/_sources/authors.rst.txt

This file was deleted.

21 changes: 0 additions & 21 deletions docs/_sources/badges.rst.txt

This file was deleted.

49 changes: 0 additions & 49 deletions docs/_sources/fullapi.rst.txt

This file was deleted.

14 changes: 0 additions & 14 deletions docs/_sources/help.rst.txt

This file was deleted.

17 changes: 0 additions & 17 deletions docs/_sources/index.rst.txt

This file was deleted.

73 changes: 0 additions & 73 deletions docs/_sources/installation.rst.txt

This file was deleted.

Loading

0 comments on commit 7ee2dbf

Please sign in to comment.