Fix issue #12: Implement edge case with empty covariate set for MINT … - #19
Merged
Conversation
…18) * Fix issue #12: Implement edge case with empty covariate set for MINT This commit addresses GitHub issue #12 and provides a fix for the related bug in issue #7 where MINT would crash with confusing error messages. Changes: 1. Enable MINT to handle empty covariate sets (covariate_vars=[]) - Added proper handling in polynomial feature generation - Updated independence test to handle 1D parameter arrays - Ensured model fitting always returns 2D arrays 2. Improved error handling for insufficient samples - Added validation to catch empty coefficient lists early - Provides clear, actionable error message instead of cryptic "Need at least one array to concatenate" error 3. Comprehensive test suite for edge cases - Tests for empty covariates with different outcome/treatment types - Tests for polynomial features with empty covariates - Tests for insufficient samples error handling All existing tests pass. The fix is backward compatible. Fixes #12 Related to #7 * Update mint.py Add len(coef_treatment_mech) == 0 to ValueError check * Update test_mint_edge_cases.py Remove unnecessary check of error test strings * Delete ISSUE_12_FIX_SUMMARY.md * Update mint.py Fix consistent output shape of fit_model_jax * Fix array shapes --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
…(#18)
This commit addresses GitHub issue #12 and provides a fix for the related bug in issue #7 where MINT would crash with confusing error messages.
Changes:
Enable MINT to handle empty covariate sets (covariate_vars=[])
Improved error handling for insufficient samples
Comprehensive test suite for edge cases
All existing tests pass. The fix is backward compatible.
Fixes #12
Related to #7
Add len(coef_treatment_mech) == 0 to ValueError check
Remove unnecessary check of error test strings
Delete ISSUE_12_FIX_SUMMARY.md
Update mint.py
Fix consistent output shape of fit_model_jax