API Add data_transposed argument and warning to make_sparse_coded_signal - #21425
Conversation
|
@amueller Thank you so much for your kind help! If any changes are necessary, I'd be happy to continue working on this issue. Please let me know we should also change the example on Orthogonal Matching Pursuit. |
|
Looking into the check failure on |
|
Yes please add an entry to the changelog :) |
Co-authored-by: Andreas Mueller <[email protected]>
|
You will also need to add an entry to the changelog, then you're all set! |
jeremiedbb
left a comment
There was a problem hiding this comment.
Thanks @g4brielvs !
I think that to be coherent we should also transpose the code and the dictionary. Actually, instead of transposing them at the end, we should change the code to directly create them with the right shape. For instance, D = generator.randn(n_features, n_components) becomes D = generator.randn(n_components, n_features).
Then you can add a test to check that the shapes of all 3 returned arrays are the expected shapes
|
Hello @g4brielvs, How is this PR going? |
|
@reshamas I'm sorry for the delay. I'll submit the changes before the end of the week. I'd really appreciate the opportunity, if possible. |
|
@thomasjpfan Thank you so much and my apologies! I am aware of the contributing guide, but unfortunately I had |
84b728d to
00b83c6
Compare
00b83c6 to
dd2841a
Compare
thomasjpfan
left a comment
There was a problem hiding this comment.
Thanks for the update. I left a comment regarding the API.
…-make_sparse_coded_signal
|
From the discussion in #21425 (comment), we can move forward with changing the order when Y, D, X = make_sparse_coded_signal(..., data_transposed=True)
# Y = D @ X
Y, X, D = make_sparse_coded_signal(..., data_transposed=False)
# Y = X @ DWe would also need to update the documentation to describe the order change. |
|
@g4brielvs I synced with main and directly pushed the changes we discussed. @thomasjpfan I think it's ready for a final review. |
thomasjpfan
left a comment
There was a problem hiding this comment.
This looks good to me. I think it would be good to have one more opinion for changing the order based on a kwarg.
Note for future reviewer: this is temporary and will last until 1.3. After that there will be only 1 return statement as before. ping @glemaitre, you assigned yourself to the issue, maybe you want to take a look here. |
glemaitre
left a comment
There was a problem hiding this comment.
I find the swap code-dictionary quite surprising
| Y = XD has shape (n_samples, n_features). | ||
|
|
||
| .. versionadded:: 1.1 | ||
| .. deprecated:: 1.1 |
There was a problem hiding this comment.
Is it deprecated or versionchanged here
There was a problem hiding this comment.
Actually it's neither. It will be both in 1.3 when we do change the default and we deprecate this arg
| n_features=n_samples, | ||
| n_nonzero_coefs=n_nonzero_coefs, | ||
| random_state=0, | ||
| data_transposed=True, |
There was a problem hiding this comment.
Do we want to change the test to deal now with the change of shape?
There was a problem hiding this comment.
I think we can leave that to when we deprecate the param
| n_features=n_samples, | ||
| n_nonzero_coefs=n_nonzero_coefs, | ||
| random_state=0, | ||
| data_transposed=True, |
There was a problem hiding this comment.
Do we want to change the test to deal now with the change of shape?
|
Congrats to @g4brielvs for completing this PR for the October sprint and everyone for reviewing it as well. |
|
Thanks @g4brielvs ! |
…nal (scikit-learn#21425) Co-authored-by: Andreas Mueller <[email protected]> Co-authored-by: jeremie du boisberranger <[email protected]> Co-authored-by: Jérémie du Boisberranger <[email protected]>
Reference Issues/PRs
Fixes #19894.
What does this implement/fix? Explain your changes.
data_transposedargument (default=True) todatasets.make_sparse_coded_signalto avoid confusion.data_transposed=True.data_transposedargument description to docstring.FutureWarningto inform future change of the default fromTruetoFalse.Any other comments?
Thanks #Data Umbrella sprint. Thanks so much for reviewing this PR!