Skip to content

[MRG+1] slight cleanup of common tests. #4058

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
Jan 15, 2015

Conversation

amueller
Copy link
Member

@amueller amueller commented Jan 6, 2015

Cleanup of common tests (somewhat in anticipation of #4052).
The goal would is to have one function for all, including meta-estimators, one for all default-constructible estimators, and then more specialized ones, in the spirit of #3810, and keeping in mind untested estimators from #4056.
This is only some of the way there.

@amueller
Copy link
Member Author

amueller commented Jan 7, 2015

@jnothman could you please have a quick look at this one? Should be easy....

# FIXME!
# in particular GaussianProcess!
yield check_estimators_overwrite_params, name, Estimator
if hasattr(Estimator, 'sparsify'):
Copy link
Member

Choose a reason for hiding this comment

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

I gather this is equivalent to the current test, but it seems strange to not just do this in test_classifier... Why here?

Also, if removing check_sparsify_binary_classifier, check_sparsify_multiclass_classifier can be renamed to simplify.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I did it here to be equivalent to the previous test. I guess adding it to the regressor and classifier tests would be possible. But maybe it will be added to other estimators in the future? Does it hurt here?

Copy link
Member

Choose a reason for hiding this comment

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

No, but it is awkward with the function name check_sparsify_multiclass_classifier

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

@amueller amueller force-pushed the cleanup_common_tests branch 2 times, most recently from a13da6a to 2813df3 Compare January 11, 2015 18:47
@amueller amueller force-pushed the cleanup_common_tests branch from 2813df3 to 1666274 Compare January 11, 2015 18:54
@jnothman
Copy link
Member

This LGTM

@amueller amueller changed the title [MRG] slight cleanup of common tests. [MRG + 1] slight cleanup of common tests. Jan 12, 2015
@amueller
Copy link
Member Author

ping @ogrisel if you have any time, so I can untangle the rest of my PRs ;)

@ogrisel ogrisel changed the title [MRG + 1] slight cleanup of common tests. [MRG+1] slight cleanup of common tests. Jan 15, 2015
est = pickle.loads(pickle.dumps(est))
assert_true(sparse.issparse(est.coef_))
pred = est.predict(X)
assert_array_equal(pred, pred_orig)
Copy link
Member

Choose a reason for hiding this comment

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

This looks wrong: this block of code should not have been deleted: est.sparsify() is no longer called in this branch.

Copy link
Member

Choose a reason for hiding this comment

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

Actually my mistake, I was fooled by the folding of the github diff for the next test.

@ogrisel
Copy link
Member

ogrisel commented Jan 15, 2015

@amueller +1 for merge as soon as the test code for est.sparsify() is restored.

@ogrisel
Copy link
Member

ogrisel commented Jan 15, 2015

Merging then.

ogrisel added a commit that referenced this pull request Jan 15, 2015
[MRG+1] slight cleanup of common tests.
@ogrisel ogrisel merged commit c1f3080 into scikit-learn:master Jan 15, 2015
@amueller
Copy link
Member Author

Thanks for the review :)

@amueller amueller deleted the cleanup_common_tests branch January 15, 2015 15:58
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.

3 participants