Repository navigation
Use fitted bins for automatic numerical PSI thresholds - #1118
Closed
Swapnil-byte-798 wants to merge 1 commit into
Closed
Swapnil-byte-798 wants to merge 1 commit into
Swapnil-byte-798 wants to merge 1 commit into
Conversation
Collaborator
|
This PR looks like it was generated end to end by an AI coding agent, without a person reviewing the change. We prefer contributions with a human in the loop: someone who understands the problem, has checked that it is real, and can discuss the design and respond to review comments. AI assistance is fine, but the contributor needs to own the change. This change needs discussion first. Please open an issue with a small worked example showing the problem that youa re trying to resolve, the PSI value, the threshold used today, and the one you think it should use. I'm closing this PR for now. Thanks for the contribution! |
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.
What changed
For
DropHighPSIFeatures(threshold="auto"), the chi-squared threshold used the requested number of bins even when equal-frequency discretization dropped duplicate quantile boundaries. Calculate the degrees of freedom from each feature's fitted bin edges.Reproduction
With 100 rows in each split, change a binary-valued numerical score from 50% ones in the basis to 73% ones in the test split. Requests for two and ten bins both fit the same two bins and give PSI ≈ 0.229. The current threshold is ≈ 0.217 with
bins=2and ≈ 0.558 withbins=10, so only the former flags drift. Both requests now use ≈ 0.217.The regression checks the numerical PSI, the feature selected for removal, and the transformed dataframe. The ten-bin case failed before the patch. All 177 tests in the focused PSI and discretization suites pass locally. Black and
git diff --checkpass.The numerical bin-count calculation may also be relevant to the migration in #1089.
Codex assisted with reproduction, implementation, and tests.