-
Notifications
You must be signed in to change notification settings - Fork 8
Add unit tests and CLAUDE.md #236
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
base: main
Are you sure you want to change the base?
Conversation
- Add tests for previously uncovered modules: - store.py (data storage classes) - latent_class_mnl.py (latent class model) - assortment_optimizer.py (optimizer factory) - Create CLAUDE.md with build/test commands and code style guidelines - Focus on convergence testing for model classes - Improve code coverage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @chicham, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request focuses on enhancing the testing and documentation of the choice-learn
library. It introduces unit tests for previously uncovered modules, specifically store.py
, latent_class_mnl.py
, and assortment_optimizer.py
, to improve test coverage and ensure the reliability of these components. Additionally, a CLAUDE.md
file is created to provide essential information for coding agents, including build/test commands and code style guidelines. The pull request also includes updates to GitHub Actions workflows to use newer versions of actions.
Highlights
- Unit Tests: Added comprehensive unit tests for
store.py
,latent_class_mnl.py
, andassortment_optimizer.py
to increase code coverage and ensure proper functionality. The tests forlatent_class_mnl.py
include convergence tests to verify model training stability. - Documentation: Created
CLAUDE.md
to provide coding standards, build, test, and linting commands, and other essential information for developers contributing to the project. - GitHub Actions Updates: Updated GitHub Actions workflows (
publish.yaml
,ci.yaml
,deploy_docs.yaml
) to use the latest versions ofactions/checkout
(v4) andactions/setup-python
(v5).
Changelog
Click here to see the changelog
- .github/actions/publish/action.yaml
- Updated
actions/checkout
to v4. - Updated
actions/setup-python
to v5.
- Updated
- .github/workflows/ci.yaml
- Updated
actions/checkout
to v4. - Updated
actions/setup-python
to v5.
- Updated
- .github/workflows/deploy_docs.yaml
- Updated
actions/checkout
to v4. - Updated
actions/setup-python
to v5.
- Updated
- CLAUDE.md
- Created
CLAUDE.md
with coding standards and commands for choice-learn. - Added build, test, and lint commands.
- Included code style guidelines such as import structure, formatting rules, and naming conventions.
- Created
- tests/unit_tests/data/test_store.py
- Created
test_store.py
to test data storage classes. - Implemented tests for
Store
,FeaturesStore
, andOneHotStore
classes, covering initialization, data handling, and property access.
- Created
- tests/unit_tests/models/test_latent_class_mnl.py
- Created
test_latent_class_mnl.py
to test theLatentClassSimpleMNL
model. - Added tests for model instantiation, dataset integration, convergence during training, and prediction functionality.
- Created
- tests/unit_tests/toolbox/test_assortment_optimizer.py
- Created
test_assortment_optimizer.py
to test assortment optimizer factory functions. - Implemented tests for
MNLAssortmentOptimizer
,LatentClassAssortmentOptimizer
, andLatentClassPricingOptimizer
classes, covering solver selection and instantiation.
- Created
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Did you know?
The term 'one-hot encoding,' frequently used in machine learning and data storage, comes from digital circuit design, where it refers to a group of bits among which only one is 'hot' (set to 1) at any given time.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces unit tests for previously uncovered modules and creates a CLAUDE.md file with build/test commands and code style guidelines. The addition of unit tests significantly improves the robustness and reliability of the codebase. The CLAUDE.md file provides valuable guidance for developers, ensuring consistency and maintainability. Overall, this is a well-structured and valuable contribution.
Merge Readiness
The pull request is well-structured and addresses the need for increased test coverage and coding guidelines. The addition of unit tests and the CLAUDE.md file are valuable contributions to the project. I am unable to approve the pull request, and recommend that others review and approve this code before merging. There are no critical or high severity issues, and the changes can be merged after addressing the medium and low severity issues.
|
||
def test_latent_class_mnl_convergence(test_dataset): | ||
"""Test that the LatentClassSimpleMNL model converges during training.""" | ||
tf.config.run_functions_eagerly(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
def test_latent_class_mnl_prediction(test_dataset): | ||
"""Test that the LatentClassSimpleMNL model can make predictions.""" | ||
tf.config.run_functions_eagerly(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report for Python 3.11
|
Coverage Report for Python 3.10
|
Coverage Report for Python 3.12
|
Summary
Details
test_store.py
for testing data storage classes (100% coverage)test_latent_class_mnl.py
for testing latent class models with convergence teststest_assortment_optimizer.py
for optimizer factory functionsTest plan
pytest --cov
🤖 Generated with Claude Code