Skip to content

[MRG] MAINT deprecate indices=False for cross validation generators#2334

Closed
jnothman wants to merge 3 commits intoscikit-learn:masterfrom
jnothman:deprecate_cv_mask
Closed

[MRG] MAINT deprecate indices=False for cross validation generators#2334
jnothman wants to merge 3 commits intoscikit-learn:masterfrom
jnothman:deprecate_cv_mask

Conversation

@jnothman
Copy link
Copy Markdown
Member

As per ML: adding some lines to remove many more in the future.

@jaquesgrobler
Copy link
Copy Markdown
Member

nice 👍 +1 for merge

@agramfort
Copy link
Copy Markdown
Member

LGTM

@jnothman
Copy link
Copy Markdown
Member Author

Since it's only deprecation, would it suit to put in 0.14 and shorten the
cycle? (I know it's not a bug fix.)

On Wed, Jul 31, 2013 at 7:36 PM, Alexandre Gramfort <
notifications@github.com> wrote:

LGTM


Reply to this email directly or view it on GitHubhttps://github.com//pull/2334#issuecomment-21850543
.

@jnothman
Copy link
Copy Markdown
Member Author

And there is also a backwards-compatibility issue with check_cv, which is
apparently part of the public API, as it had returned a generator with
indices=False for non-sparse data (undocumented). Does the change in
behaviour need to be documented?

On Wed, Jul 31, 2013 at 7:43 PM, Joel Nothman
jnothman@student.usyd.edu.auwrote:

Since it's only deprecation, would it suit to put in 0.14 and shorten the
cycle? (I know it's not a bug fix.)

On Wed, Jul 31, 2013 at 7:36 PM, Alexandre Gramfort <
notifications@github.com> wrote:

LGTM


Reply to this email directly or view it on GitHubhttps://github.com//pull/2334#issuecomment-21850543
.

@agramfort
Copy link
Copy Markdown
Member

it should not break people's code so I would just add a note in the what's
new API section.

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Jul 31, 2013

I get the following test failures:

======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/ogrisel/code/scikit-learn/sklearn/tests/test_common.py", line 798, in test_regressors_train
    assert_raises(ValueError, regressor.fit, X, y[:-1])
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 475, in assertRaises
    callableObj(*args, **kwargs)
  File "/Users/ogrisel/code/scikit-learn/sklearn/linear_model/least_angle.py", line 937, in fit
    for train, test in cv)
  File "/Users/ogrisel/code/scikit-learn/sklearn/externals/joblib/parallel.py", line 516, in __call__
    for function, args, kwargs in iterable:
  File "/Users/ogrisel/code/scikit-learn/sklearn/linear_model/least_angle.py", line 937, in <genexpr>
    for train, test in cv)
IndexError: index 199 is out of bounds for size 199

----------------------------------------------------------------------

I don't get that on master. So it seems to have an impact there. @agramfort or @fabianp can you reproduce?

@GaelVaroquaux
Copy link
Copy Markdown
Member

Since it's only deprecation, would it suit to put in 0.14 and shorten the cycle?

I am not very confortable with this: the change has side effects. Let us
wait a bit.

@jnothman
Copy link
Copy Markdown
Member Author

I am not very confortable with this: the change has side effects. Let us
wait a bit.

np

On Thu, Aug 1, 2013 at 6:12 AM, Gael Varoquaux notifications@github.comwrote:

Since it's only deprecation, would it suit to put in 0.14 and shorten
the cycle?

I am not very confortable with this: the change has side effects. Let us
wait a bit.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2334#issuecomment-21891942
.

@agramfort
Copy link
Copy Markdown
Member

I cannot reproduce this failure. Anyone else?

@agramfort
Copy link
Copy Markdown
Member

problem reproduced using Canopy.

can you add a :

X, y = check_arrays(X, y)

at the beginning of the fit in LarsCV and OrthogonalMatchingPursuitCV ?

it should fix the problem. Don't ask me why it's not necessary on
my other python setup...

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Aug 3, 2013

@GaelVaroquaux, I've attempted that check_cv warning. Atm, however, they'll get two warnings:

sklearn/cross_validation.py:1222: DeprecationWarning: check_cv will return indices instead of boolean masks from 0.17
  'masks from 0.17', DeprecationWarning)
sklearn/cross_validation.py:63: DeprecationWarning: The indices parameter is deprecated and will be removed (assumed True) in 0.17
  "removed (assumed True) in 0.17", DeprecationWarning)
sklearn.cross_validation.KFold(n=3, n_folds=3)

Perhaps I should either pass a parameter to affect the KFold warnings, or use warnings module to filter them out...

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Aug 3, 2013

@ogrisel, I've heeded @agramfort to add some check_arrays. Fixed for you?

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Aug 3, 2013

That works for me as well. +1 for merge. Thanks @agramfort for the fix.

@larsmans
Copy link
Copy Markdown
Member

larsmans commented Aug 3, 2013

👍 for merge!

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Aug 3, 2013

Seeing as @GaelVaroquaux was concerned about check_cv, I'd like to hear from him before merge.

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Aug 8, 2013

@GaelVaroquaux, is this good to merge? I just want to check that the deprecation of check_cv satisfactory.

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Sep 9, 2013

I have rebased this on master, and intend to merge tomorrow unless @GaelVaroquaux objects.

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Sep 10, 2013

I just merged #2370 to clean up the doc a bit. I think this PR should further edit the documentation (after rebasing onto master) to not show the indices=True option anymore.

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Sep 10, 2013

I meant "to not show the indices=False option anymore".

@larsmans
Copy link
Copy Markdown
Member

Merged by rebase, docs fixed.

@larsmans larsmans closed this Sep 10, 2013
@arjoly
Copy link
Copy Markdown
Member

arjoly commented Sep 10, 2013

Thanks!

@jnothman jnothman deleted the deprecate_cv_mask branch September 10, 2013 12:20
@jnothman
Copy link
Copy Markdown
Member Author

Hmmm... I've realised that despite the support for this PR, it's not complete: the DeprecationWarning will only show if indices=False, not if indices is explicitly passed as True. I'll throw together a fix.

vene pushed a commit to vene/seqlearn that referenced this pull request Feb 15, 2016
They're going to be deprecated in scikit-learn soon,
scikit-learn/scikit-learn#2334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants