Skip to content

Metaestimator delegation test does not pass y as a parameter #12088

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

Closed
orausch opened this issue Sep 15, 2018 · 0 comments · Fixed by #12089
Closed

Metaestimator delegation test does not pass y as a parameter #12088

orausch opened this issue Sep 15, 2018 · 0 comments · Fixed by #12089

Comments

@orausch
Copy link

orausch commented Sep 15, 2018

Description

While working on PR #11682 I stumbled upon this small issue in tests/test_metaestimator.py. In the delegation test, score only has the parameter X, while estimators expect X and y to be passed. Because of this, RFE and RFECV cannot be tested for score delegation.

Steps/Code to Reproduce

Remove score from the skip_methods for RFE and RFECV in test_metaestimator.py and run the test.

Expected Results

The test passes.

Actual Results

It fails with:

E
======================================================================
ERROR: sklearn.tests.test_metaestimators.test_metaestimator_delegation
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/oliver/repos/scikit-learn/sklearn/tests/test_metaestimators.py", line 124, in test_metaestimator_delegation
    delegator_data.fit_args[0])
  File "/home/oliver/repos/scikit-learn/sklearn/utils/_unittest_backport.py", line 204, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/home/oliver/repos/scikit-learn/sklearn/utils/_unittest_backport.py", line 113, in handle
    callable_obj(*args, **kwargs)
  File "/home/oliver/repos/scikit-learn/sklearn/utils/metaestimators.py", line 118, in <lambda>
    out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs)
TypeError: score() missing 1 required positional argument: 'y'

----------------------------------------------------------------------
Ran 1 test in 0.006s

FAILED (errors=1)

Versions

Linux-4.18.7_2-x86_64-with-glibc2.3.4
Python 3.6.6 (default, Jul 16 2018, 09:23:17) 
[GCC 7.3.0]
NumPy 1.15.1
SciPy 1.1.0
Scikit-Learn 0.21.dev0
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 a pull request may close this issue.

1 participant