Repository navigation
FIX IsolationForest accepts sparse matrix with float value contamination - #27645
Merged
Merged
Conversation
adam2392
reviewed
Nov 6, 2023
adam2392
approved these changes
Nov 9, 2023
| """ | ||
| X, _ = make_classification(n_samples=50, n_features=4, random_state=0) | ||
| X = sparse_container(X) | ||
| X.sort_indices() |
Member
There was a problem hiding this comment.
Out of curiosity, why do we need to sort the indices?
Member
Author
There was a problem hiding this comment.
I have no idea. I took back the minimum reproducer but it was probably failing without sorting indices.
Member
There was a problem hiding this comment.
Sorting indices allows getting into a canonical representation (e.g. with no duplicates' ambiguity).
jjerphan
approved these changes
Nov 28, 2023
OmarManzoor
reviewed
Dec 1, 2023
OmarManzoor
approved these changes
Dec 2, 2023
OmarManzoor
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Thanks @glemaitre
OmarManzoor
enabled auto-merge (squash)
December 2, 2023 06:31
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 #27626
This PR makes sure to convert to CSR the validated CSC matrix when contamination is a floating number. We still don't want to call
score_samplesbecause it will cost an additional validation, more expensive than the expectedX.asformat("csr").