-
Notifications
You must be signed in to change notification settings - Fork 841
Add BaseDRClassifier for binary classification with probabilities #844
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
Conversation
Implements BaseDRClassifier class to address issue #819 by providing a DR-learner that outputs probabilities for binary classification problems, similar to other S/T/X learner classifiers. Key features: - Uses predict_proba() for outcome models to return probabilities - Maintains doubly robust estimation framework - Supports both single learner and separate outcome/effect learners - Includes comprehensive tests with classification data - Follows existing classifier implementation patterns Fixes #819 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add black as a dependency in pyproject.toml - Format test_meta_learners.py with black - Fix code style issues for CI/CD pipeline 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Update all commands to use uv instead of pip/pytest - Add mandatory black formatting before push workflow - Include complete development workflow with linting steps - Emphasize code quality requirements for CI/CD 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove CLAUDE.md and .claude/ from git tracking - Add Claude Code artifacts to .gitignore - Keep repository clean of development tooling files 🤖 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.
Pull Request Overview
This PR implements BaseDRClassifier to provide doubly robust learning with probability outputs for binary classification problems, addressing issue #819. The implementation follows the existing pattern of other meta-learner classifiers in the codebase.
Key changes:
- Added
BaseDRClassifierclass that usespredict_proba()for probabilistic binary classification - Updated module exports to include the new classifier
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| causalml/inference/meta/drlearner.py | Implements the core BaseDRClassifier class with probabilistic prediction methods |
| causalml/inference/meta/init.py | Exports the new BaseDRClassifier class |
| tests/test_meta_learners.py | Adds comprehensive tests for the new classifier functionality |
| pyproject.toml | Adds black dependency for code formatting |
- Improve docstring completeness with detailed parameter descriptions - Clarify usage of treatment/y parameters for classification metrics - Explain return_components output format with probability details - Separate DR learner imports for better readability - Maintain API consistency with other meta-learners Addresses comments in #844 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
Thank you for the detailed review! I've addressed the comments as follows: ✅ Documentation Improvements
✅ Import Style Improvement
🤔 API Consistency DecisionRegarding the first comment about removing
The current implementation follows the established pattern across the entire CausalML meta-learner ecosystem, where optional parameters enable additional functionality without breaking the core prediction workflow. All changes have been applied with proper black formatting. The implementation now provides comprehensive documentation while maintaining full API consistency with the existing codebase. |
Summary
Implements
BaseDRClassifierclass to address issue #819 by providing a DR-learner that outputs probabilities for binary classification problems, similar to other S/T/X learner classifiers.Test plan
test_meta_learners.pyChanges
Core Implementation
BaseDRClassifierclass incausalml/inference/meta/drlearner.pyBaseDRLearnerfor consistencypredict_proba()for outcome models to return probabilitiesAPI Integration
causalml/inference/meta/__init__.pytests/test_meta_learners.pyKey Features
predict_proba()[:, 1]for binary classificationclassification_metricsUsage Example
Fixes #819
🤖 Generated with Claude Code