Skip to content

FIX Cast integer X to float in BaseMixture score_samples, predict, predict_proba - #35608

Open
AadityaBhuree wants to merge 1 commit into
scikit-learn:mainfrom
AadityaBhuree:fix/mixture-validate-data-float-dtype
Open

AadityaBhuree wants to merge 1 commit into
scikit-learn:mainfrom
AadityaBhuree:fix/mixture-validate-data-float-dtype

Conversation

@AadityaBhuree

Copy link
Copy Markdown

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.

Copilot AI adaptive review requested due to automatic review settings December 2, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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, and predict_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)

Comment thread sklearn/mixture/_base.py
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)
Comment thread sklearn/mixture/_base.py
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

No deployments
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.

GaussianMixture returns wrong scores and probabilities for integer X since 1.7

2 participants