Repository navigation
FIX Cast integer X to float in BaseMixture score_samples, predict, predict_proba - #35608
Open
AadityaBhuree wants to merge 1 commit into
Open
AadityaBhuree wants to merge 1 commit into
AadityaBhuree wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Approval is blocked by an unremoved duplicate namespace lookup and missing regression coverage for the new casting behavior across covariance types.
2 open issues
What changed in this PR
Fixes integer-input truncation in BaseMixture inference methods while preserving float32 inputs.
Changes:
- Applies float32/float64 validation to
score_samples,predict, andpredict_proba. - Aligns inference behavior with
fit_predict.
| File | Description |
|---|---|
| sklearn/mixture/_base.py | Updates BaseMixture inference input validation to safely handle integer and float32 inputs. |
Review effort: Lite (adaptive)
| check_is_fitted(self) | ||
| X = validate_data(self, X, reset=False) | ||
| xp, _ = get_namespace(X) | ||
| X = validate_data(self, X, dtype=[xp.float64, xp.float32], reset=False) |
| check_is_fitted(self) | ||
| xp, _ = get_namespace(X) | ||
| X = validate_data(self, X, reset=False) | ||
| xp, _ = get_namespace(X) |
This branch has not been deployed
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.


Closes #35583 - Pass dtype=[xp.float64, xp.float32] to validate_data() in BaseMixture.score_samples, predict, and predict_proba (matching fit_predict) so integer inputs are not truncated in _estimate_log_gaussian_prob while float32 inputs remain float32.