Fixed issue where yield test wrapped with skip_if_32bit was not run#7656
Fixed issue where yield test wrapped with skip_if_32bit was not run#7656Erotemic wants to merge 2 commits intoscikit-learn:masterfrom
Conversation
|
Thanks @Erotemic. Does one of the tree hackers (@nelson-liu?) want to fix the underlying bug, which lies in the calculation of |
sklearn/utils/testing.py
Outdated
| else: | ||
| return func(*args, **kwargs) | ||
| return run_test | ||
| if inspect.isgeneratorfunction(func): |
There was a problem hiding this comment.
I think you can get rid of some of the code duplication.
There was a problem hiding this comment.
I changed it so if skip_if_32bit is called with a generator it recalls skip_if_32bit with the functions it generates. This maintains the original way the function was written and removes duplicate code. It does introduce technically introduce a recursive call, but in practice the recursion depth should never exceed 1.
|
can you maybe print |
|
@amueller I sorted the importances in descending order and then printed them out It does not seem to be just a numerical error. The third best feature is not close to 0.1 Perhaps this is an error in |
|
No, the tests make false assumptions because not all informative features On 16 October 2016 at 08:33, Jon Crall notifications@github.com wrote:
|
|
even a cube will do On 16 October 2016 at 08:58, Joel Nothman joel.nothman@gmail.com wrote:
|
|
@jnothman I can try to take a look at this over the weekend, sorry for the long response time. |
|
|
|
Yeah so either we fix this for the release or we skip the test :-/ |
|
Ok actually I have no idea what's happening here and I need to get dinner. But I'm very confused. Why does a test that has a skip_if_32 fail only on 32bit? |
|
ah, the tests are only skipped for the ensembles, not the trees.... if this test is fixed, the tree test needs to be fixed, too. |
|
I'll can look into that |
|
Fixed by #9282. |
In #7654 I discovered that a yield test was not being run by nosetests because it was wrapped in skip_if_32bit.
Previously
nosetests sklearn.ensemble.tests.test_forest:test_importances --verbosewould outputHowever, this success was simply because nothing was being run.
With the change all 10 of the tests embeded in this one function are run. Unfortunately they are all failing.
What I did to fix the initial problem was in
skip_if_32bitI checked if the input function was a generator.If it was not then the function runs like it used to. If it is a generator I create a different wrapper that re-yields the results if the function is enabled and yields functions that raise SkipTest errors if the function is disabled.
I also raised NotImplemented errors in other wrappers if a generator function is passed in.