Skip to content

[MRG + 1] deprecated randomized_l1 #9031

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

Merged
merged 1 commit into from
Jun 30, 2017
Merged

Conversation

Sentient07
Copy link
Contributor

This PR attempts to fix #8995

@Sentient07
Copy link
Contributor Author

@agramfort I'm not sure how the deprecation should be done, I added warning at the top of the file that is deprecated. @GaelVaroquaux asked me a gist of the code that has been removed, but I didn't remove any for now, rather in the warning message, said it would be removed in the next release

@agramfort
Copy link
Member

@Sentient07 read this http://scikit-learn.org/stable/developers/contributing.html#deprecation

you'll also need to remove reference to this code in narrative documentation

@jnothman
Copy link
Member

jnothman commented Jun 7, 2017 via email

@Sentient07
Copy link
Contributor Author

Sorry, had a long day of work and travel couldn't get back earlier. I had removed the deprecated module's code from the example section and specified the versions in which this module will be deprecated and removed.

@agramfort
Copy link
Member

@Sentient07 there should be no warning when running the test of building the doc

@agramfort
Copy link
Member

since you won't remove the tests now it means you need to capture the warnings

@Sentient07
Copy link
Contributor Author

Understood. But is it preferred to remove the tests ? ( cross_validation still seems to have its test, but raising warnings when the module is trying to be imported)

@Sentient07
Copy link
Contributor Author

Also, should I get rid of the examples/linear_model/plot_sparse_recovery module? I am not sure if it would be of much use once we get rid of the RandomisedLasso

@agramfort
Copy link
Member

agramfort commented Jun 8, 2017 via email

@Sentient07
Copy link
Contributor Author

Sentient07 commented Jun 8, 2017

@agramfort I have caught and ignored the warnings in test. I tested with no-capture option, and I don't see any warnings while running the tests. Also, I have removed the example and the related documentations. (I am not very sure what is narrative documentation)

@jnothman
Copy link
Member

jnothman commented Jun 8, 2017 via email

@jnothman
Copy link
Member

flake8 failures:

Running flake8 on the diff in the range 623ee42..158cda7 (3 commit(s)):
--------------------------------------------------------------------------------
./sklearn/linear_model/randomized_l1.py:34:16: E127 continuation line over-indented for visual indent
               DeprecationWarning)
               ^
./sklearn/linear_model/tests/test_randomized_l1.py:20:80: E501 line too long (81 > 79 characters)
                                                    RandomizedLogisticRegression)
                                                                               ^

@jnothman jnothman changed the title deprecated randomized_l1 [MRG] deprecated randomized_l1 Jun 14, 2017
@Sentient07
Copy link
Contributor Author

Sorry about the flake8 errors, I have fixed that and squashed the commits into one.

@jnothman
Copy link
Member

jnothman commented Jun 14, 2017 via email

@Sentient07
Copy link
Contributor Author

No problem, I will do the changes tomorrow.

@amueller amueller changed the title [MRG] deprecated randomized_l1 [WIP] deprecated randomized_l1 Jun 19, 2017
@amueller
Copy link
Member

@Sentient07 are you still on this? Usually I wouldn't be nagging, but we're trying to move towards a release ;)

@Sentient07
Copy link
Contributor Author

Sentient07 commented Jun 19, 2017 via email

@Sentient07
Copy link
Contributor Author

@amueller sorry for the delay, I made the deprecation similar to GMM, fixed the merge conflict.

Copy link
Member

@amueller amueller left a comment

Choose a reason for hiding this comment

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

Looks good, but you need to fix the flake8 errors for travis to pass. Also, can you please add a test that checks that a warning is actually raised when instantiating an object of the class with assert_warns_message? Thanks!

from .randomized_l1 import (RandomizedLasso, RandomizedLogisticRegression,
lasso_stability_path)

with warnings.catch_warnings():
Copy link
Member

Choose a reason for hiding this comment

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

you don't need to catch here, importing will not raise a deprecation warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! Forgot to remove

@amueller
Copy link
Member

Oh also please add an entry to whats_new.rst

@Sentient07
Copy link
Contributor Author

Sentient07 commented Jun 20, 2017

@amueller I made the changes that you suggested. I did not test it locally as after the recent rebase, I am getting stuck with this error, ImportError: cannot import name bincount. Google results suggest me to update numpy but that did not work for me. I am pushing leaving the tests to Travis as I don't want this to postpone the release. Apologies.

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

And if you otherwise think your work here is complete and want a full review, change the title's WIP to MRG.

@@ -30,8 +30,7 @@
from .passive_aggressive import PassiveAggressiveClassifier
from .passive_aggressive import PassiveAggressiveRegressor
from .perceptron import Perceptron
from .randomized_l1 import (RandomizedLasso, RandomizedLogisticRegression,
Copy link
Member

Choose a reason for hiding this comment

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

We still need this. It is the source of test failures.

@massich
Copy link
Contributor

massich commented Jun 28, 2017

@Sentient07, this is a blocker issue.
I think there is not much to be done in order to finish it. If you don't have the time to fix it soon, ping me and I'll take over.

@Sentient07
Copy link
Contributor Author

I had pushed a commit before and it didn't get updated here. I have pushed it again. Once Travis passes, I'll change it to mrg

@Sentient07 Sentient07 changed the title [WIP] deprecated randomized_l1 [MRG] deprecated randomized_l1 Jun 28, 2017
@@ -1279,6 +1279,9 @@ Model evaluation and meta-estimators
the parameter ``n_labels`` is renamed to ``n_groups``.
:issue:`6660` by `Raghav RV`_.

- The :mod:`sklearn.linear_model.randomized_l1` is deprecated.
:issue: `8995` by `Andreas Mueller`_.
Copy link
Member

Choose a reason for hiding this comment

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

The "by" refers to the contributor, so you. You can use the :user: pattern as elsewhere in whatsnew.

Copy link
Member

Choose a reason for hiding this comment

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

There should be a list of deprecated functions in 0.19 in the whatsnew.

Copy link
Member

@amueller amueller left a comment

Choose a reason for hiding this comment

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

LGTM apart from whatsnew nitpicks.

@@ -30,8 +30,10 @@
from .passive_aggressive import PassiveAggressiveClassifier
from .passive_aggressive import PassiveAggressiveRegressor
from .perceptron import Perceptron

Copy link
Member

Choose a reason for hiding this comment

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

why the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably when I added code for catching the exception at the time of import, after removing it, this empty line came up

@@ -58,6 +60,8 @@ def _resample_model(estimator_func, X, y, scaling=.5, n_resampling=200,
return scores_


@deprecated("The class BaseRandomizedLinearModel is deprecated in 0.19"
Copy link
Member

Choose a reason for hiding this comment

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

Hm this should not have been public, but given that it was, deprecating it is the right thing to do.

@@ -1279,6 +1279,9 @@ Model evaluation and meta-estimators
the parameter ``n_labels`` is renamed to ``n_groups``.
:issue:`6660` by `Raghav RV`_.

- The :mod:`sklearn.linear_model.randomized_l1` is deprecated.
:issue: `8995` by `Andreas Mueller`_.
Copy link
Member

Choose a reason for hiding this comment

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

There should be a list of deprecated functions in 0.19 in the whatsnew.

@amueller amueller changed the title [MRG] deprecated randomized_l1 [MRG + 1] deprecated randomized_l1 Jun 29, 2017
Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM as well once @amueller's comments are addressed.

Removed the deprecated module's code from examples

Added warning

removed from narrative documentation

fixed flake8

Changed deprecation style to GMM

Added tests and fixed flake8

Added removed code and updated whats_new

Modified whatsnew
@Sentient07
Copy link
Contributor Author

Addressed comments, squashed into one commit

@ogrisel
Copy link
Member

ogrisel commented Jun 30, 2017

The CI errors are all cause by mldata.org 500 errors. Merging.

@ogrisel ogrisel merged commit c10c886 into scikit-learn:master Jun 30, 2017
@ogrisel
Copy link
Member

ogrisel commented Jun 30, 2017

Thanks @Sentient07!

massich pushed a commit to massich/scikit-learn that referenced this pull request Jul 13, 2017
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate randomized_l1 module
6 participants