Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renew Documentation #62

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and it also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [[email protected]]. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

[homepage]: https://www.contributor-covenant.org
67 changes: 67 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## <issue title>

<!--
Provide a brief and clear title for the issue.
-->

### Issue Type

- [ ] Bug
- [ ] Feature Request
- [ ] Improvement

### Description

<!--
Provide a detailed description of the issue or feature request.
For bugs, include steps to reproduce the issue.
For feature requests or improvements, describe the functionality or enhancement you'd like to see.
-->

### Steps to Reproduce (For Bugs)

1. Step one
2. Step two
3. Step three

<!--
Replace the above steps with actual steps that reproduce the bug.
-->

### Expected Behavior

<!--
What should happen under normal circumstances?
-->

### Actual Behavior

<!--
What is happening instead of the expected behavior?
-->

### Environment Details

- **Operating System**:
- **Python Version**:
- **Dependencies**: (e.g., `numpy`, `pandas`, or other relevant packages)
- **Browser (if applicable)**:
- **Device (if applicable)**:

### Possible Solution (if any)

<!--
If you have any idea how to fix this issue, please share.
-->

### Screenshots (if applicable)

<!--
Add screenshots if they help explain the issue.
-->

### Checklist

- [ ] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document.
- [ ] I have checked if this issue has been reported previously.
- [ ] I have provided all necessary details to reproduce the issue (if applicable).
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.

Loading
Loading