Skip to content

Lazy check estimator #7

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

Open
wants to merge 1 commit into
base: disassemble_check_estimator
Choose a base branch
from

Conversation

amueller
Copy link

This makes everything work as expected, I think.

from itertools import chain

import pytest
from sklearn.base import BaseEstimator
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.estimator_checks import set_check_estimator_ids
from sklearn.linear_model import SGDClassifier
from sklearn.pipeline import Pipeline
from sklearn.feature_selection import RFE


class Bla(BaseEstimator):
    def __init__(self, a, b):
        self.a = a
        self.b = b

# first three pass, pipeline skips, last fails
estimators = [SGDClassifier(), SGDClassifier, RFE, Pipeline, Bla]


@pytest.mark.parametrize(
    'estimator, check',
    chain.from_iterable(check_estimator(est, generate_only=True)
                        for est in estimators),
    ids=set_check_estimator_ids)
def test_sklearn_compatible_estimator(estimator, check):
    check(estimator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants