Add Multi-Armed Bandit (MAB) algorithms and evaluation utilities#833
Open
zhenyuz0500 wants to merge 10 commits intouber:masterfrom
Open
Add Multi-Armed Bandit (MAB) algorithms and evaluation utilities#833zhenyuz0500 wants to merge 10 commits intouber:masterfrom
zhenyuz0500 wants to merge 10 commits intouber:masterfrom
Conversation
Collaborator
|
Thanks for the contribution, @zhenyuz0500. Can you add an example notebook? It will help users understand when/how to use it. |
…nt logic for consistency and correctness
…hms to use numpy arrays instead of DataFrames - Add new notebook example for MAB algorithms - Remove old comparison script and test file - Update test cases to match new API
Add mab_bandit_model_demo.ipynb and update mab_bandit_model_compariso…
Remove mab_bandit_example.ipynb from the PR
Collaborator
|
@zhenyuz0500, can you fix the lint error by running the latest black on the changes? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This PR introduces a set of classical Multi-Armed Bandit (MAB) algorithms and supporting utilities to the CausalML codebase. The implementation includes:
Core MAB algorithms in
causalml/causalml/optimize/bandit.py:Simulation utilities in
causalml/causalml/dataset/mab_simulation.py:Evaluation metrics in
causalml/causalml/metrics/mab_evaluation.py:Example notebooks:
mab_bandit_model_demo.ipynb: A comprehensive demonstration of all MAB algorithms, including:mab_bandit_model_comparison.ipynb: A focused comparison of different MAB algorithms with:Unit tests in
causalml/tests/test_bandit.pyThis addition provides a foundation for experimentation and benchmarking of bandit algorithms within the CausalML ecosystem, supporting both research and practical applications.
Types of changes
What types of changes does your code introduce to CausalML?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
The implementation follows the existing CausalML codebase structure and style, with a focus on:
The MAB algorithms are implemented as classes that inherit from a common base class, making it easy to add new algorithms in the future. The evaluation utilities provide both numerical metrics and visualization tools, making it easy to compare different algorithms' performance.
The implementation has been tested with various scenarios, including:
All algorithms have been benchmarked against each other to ensure they perform as expected in different scenarios. The example notebooks provide clear demonstrations of how to use each algorithm type and how to interpret their performance.
Recent improvements include:
n_armsparameterBatchBanditwrapper correctlyLinUCBupdates