-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+1] Do not transform y #9180
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
Conversation
@agramfort @amueller This should now ensure all CIs pass. Can you review this? |
(The codecov seems to pull up test misses that are not relevant to this PR) |
@@ -528,22 +531,29 @@ def fit(self, X, y=None): | |||
self._fit(X, compute_sources=False) | |||
return self | |||
|
|||
def transform(self, X, y=None, copy=True): | |||
def transform(self, X, y='deprecated', copy=True): |
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.
Why deprecation here and not elsewhere?
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.
sorry for that will push a commit fixing this.
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.
because here there is copy param so we cannot just remove y from the signature like above.
doc/whats_new.rst
Outdated
@@ -539,6 +539,11 @@ API changes summary | |||
- ``utils.stats.rankdata`` | |||
- ``neighbors.approximate.LSHForest`` | |||
|
|||
- Deprecate the ``y`` parameter in :meth:`transform`. |
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.
and :meth:inverse_transform
not sure this renders ok though as it should not point to anything specific
doc/whats_new.rst
Outdated
@@ -539,6 +539,11 @@ API changes summary | |||
- ``utils.stats.rankdata`` | |||
- ``neighbors.approximate.LSHForest`` | |||
|
|||
- Deprecate the ``y`` parameter in :meth:`transform`. | |||
The method should not accept ``y`` parameter, as it's used at the prediction time. | |||
:issue:`8174` by :user:`Tahar Zanouda <tzano>`. |
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.
change this
besides LGTM. Thx @raghavrv |
doc/whats_new.rst
Outdated
- Deprecate the ``y`` parameter in `transform` and `inverse_transform`. | ||
The method should not accept ``y`` parameter, as it's used at the prediction time. | ||
:issue:`8174` by :user:`Tahar Zanouda <tzano>`, :user:`Alexandre Gramfort`_ | ||
and :user:`Raghav RV`_. |
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 doubt this renders fine for you and me
I think for me it should only be Alexandre Gramfort
_ as below
11d318a
to
223a5b3
Compare
LGTM +1 for MRG |
thanks for the review! |
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'm okay with this. But I am also sure we'll break someone's code; someone who passed y to transform because the signature asked for it.
sklearn/cross_decomposition/pls_.py
Outdated
X : array-like of predictors, shape = [n_samples, p] | ||
Training vectors, where n_samples in the number of samples and | ||
p is the number of predictors. | ||
""" |
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.
Did we agree that we're best to just leave Y undocumented in PLS?
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.
We set a precedent for that here - https://github.com/scikit-learn/scikit-learn/pull/9066/files Could I factor in your +1 for a merge? :) |
LGTM
|
With Alex's and Tom's +1, in it goes! Thanks everyone. |
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
Is there an alternative way of doing a "supervised transformation" now that the "y" parameter is unavailable? |
|
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
* we do not transform y * more * added Deprecation Warning to transform() to remove Y parameter * more * ENH ensure FunctionTransformer's transform/inverse_transform doesn't permit y * Undo changes to pls_. It will be done in a separate PR (see scikit-learn#9160) * flake8 * Update whatsnew * Fully undo PLS changes
This takes over @agramfort's PR #9075
For the PR specific to PLS see #9160