Skip to content

Validate binary outcome in filter_LR / filter_D (#349)#941

Open
jeongyoonlee wants to merge 1 commit into
masterfrom
feature/349-filter-binary-validation
Open

Validate binary outcome in filter_LR / filter_D (#349)#941
jeongyoonlee wants to merge 1 commit into
masterfrom
feature/349-filter-binary-validation

Conversation

@jeongyoonlee

Copy link
Copy Markdown
Collaborator

Proposed changes

The likelihood-ratio filter (filter_LR) and the divergence-based filters (filter_DKL / ED / Chi) model a binary conversion outcome. Passing a continuous or multi-class outcome previously produced meaningless statistics silently, with no error.

This adds a module-level _check_binary_outcome() helper, called at the top of filter_LR and filter_D, that raises a clear ValueError naming the offending outcome column and pointing to filter_F (the OLS F-test filter, which tolerates continuous outcomes). The module docstring now documents the binary-only constraint. filter_F is unchanged.

Fixes #349.

Credit

Reimplements the work of @jbbqqf in #898, which is CLA-blocked and cannot be merged directly. Full credit to @jbbqqf for the original implementation and analysis; this PR re-lands the same feature against current master under a CLA-clean author.

Types of changes

  • New feature (non-breaking change which adds functionality)

Tests

  • New parametrized test_filter_rejects_non_binary_outcome over ["LR", "KL", "ED", "Chi"] (4-class outcome → ValueError matching "binary") and test_filter_f_accepts_continuous_outcome (continuous outcome still works through filter_F). The rejects tests fail on master (no error raised), pass here.
  • Full tests/test_feature_selection.py — 8 passed.

The likelihood-ratio filter (filter_LR) and the divergence-based filters
(filter_D: KL / ED / Chi) model a binary conversion outcome. Passing a
continuous or multi-class outcome previously produced meaningless statistics
silently. Add a module-level _check_binary_outcome() helper, called at the top
of filter_LR and filter_D, that raises a clear ValueError naming the offending
column and pointing to filter_F for continuous outcomes. The module docstring
now documents the binary-only constraint.

Reimplements the work of @jbbqqf in #898 (CLA-blocked). Closes #349.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify the limitations (specifically the label) of the current implementation of filter methods

1 participant