-
-
Notifications
You must be signed in to change notification settings - Fork 25.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX avoid unecessary/duplicated if copy
branch for sparse arrays/matrix
#27336
Conversation
@@ -962,6 +962,19 @@ def is_sparse(dtype): | |||
allow_nan=force_all_finite == "allow-nan", | |||
) | |||
|
|||
if copy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above if
take care about the SciPy sparse copy already. This should only be done in the else
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the call to _ensure_sparse_format
already takes care of handling the copy
argument so there is no need to do it twice for sparse inputs.
The remaining failures are in the docstring and a related to the way information is displayed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please fix the title of the PR? It's seems grammatically invalid and I am not sure what you mean.
I think this PR would be easier to review if it were to focus on a single problem (e.g. the |
np.may_share_memory
on sparse arrays
np.may_share_memory
on sparse arraysif copy
branch for sparse arrays/matrix
Let me revert the problem of the representation |
04311c2
to
d65d901
Compare
I kind of think this dok array issue is a scipy regression and I was hoping it would get fixed in scipy. I was planning to follow up on scipy/scipy#18929 (comment) for directions. Having said that, if there is an easy work-around that avoids the issue in scikit-learn, why not ... |
I open the following in scipy to kind having something working: scipy/scipy#19220
Actually this is a silent bug where all stars were aligned.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the previous comments, the fix itself LGTM!
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, putting this on auto-merge
…-learn#27336) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
This should solve the issue observed in the scipy-dev build.
#27171 (comment)
In a later PR, we should make a better test for
check_array
.