Esempio n. 1
0
def check_estimator(Estimator, run_sampler_tests=True):
    """Check if estimator adheres to scikit-learn conventions and
    imbalanced-learn

    This estimator will run an extensive test-suite for input validation,
    shapes, etc.
    Additional tests samplers if the Estimator inherits from the corresponding
    mixin from imblearn.base

    Parameters
    ----------
    Estimator : class
        Class to check. Estimator is a class object (not an instance)

    run_sampler_tests=True : bool, default=True
        Will run or not the samplers tests.
    """
    name = Estimator.__name__
    # monkey patch check_dtype_object for the sampler allowing strings
    import sklearn.utils.estimator_checks
    sklearn.utils.estimator_checks.check_dtype_object = \
        monkey_patch_check_dtype_object
    # scikit-learn common tests
    sklearn_check_estimator(Estimator)
    check_parameters_default_constructible(name, Estimator)
    if run_sampler_tests:
        for check in _yield_all_checks(name, Estimator):
            check(name, Estimator)
def check_estimator(Estimator, run_sampler_tests=True):
    """Check if estimator adheres to scikit-learn conventions and
    imbalanced-learn

    This estimator will run an extensive test-suite for input validation,
    shapes, etc.
    Additional tests samplers if the Estimator inherits from the corresponding
    mixin from imblearn.base

    Parameters
    ----------
    Estimator : class
        Class to check. Estimator is a class object (not an instance)

    run_sampler_tests=True : bool, default=True
        Will run or not the samplers tests.
    """
    name = Estimator.__name__
    # monkey patch check_dtype_object for the sampler allowing strings
    import sklearn.utils.estimator_checks
    sklearn.utils.estimator_checks.check_dtype_object = \
        monkey_patch_check_dtype_object
    # scikit-learn common tests
    sklearn_check_estimator(Estimator)
    check_parameters_default_constructible(name, Estimator)
    if run_sampler_tests:
        for check in _yield_all_checks(name, Estimator):
            check(name, Estimator)
Esempio n. 3
0
def check_estimator(Estimator):
    """Check if estimator adheres to scikit-learn conventions and
    imbalanced-learn

    This estimator will run an extensive test-suite for input validation,
    shapes, etc.
    Additional tests samplers if the Estimator inherits from the corresponding
    mixin from imblearn.base

    Parameters
    ----------
    Estimator : class
        Class to check. Estimator is a class object (not an instance).
    """
    name = Estimator.__name__
    # test scikit-learn compatibility
    sklearn_check_estimator(Estimator)
    check_parameters_default_constructible(name, Estimator)
    for check in _yield_all_checks(name, Estimator):
        check(name, Estimator)
def check_estimator(Estimator):
    """Check if estimator adheres to scikit-learn conventions and
    imbalanced-learn

    This estimator will run an extensive test-suite for input validation,
    shapes, etc.
    Additional tests samplers if the Estimator inherits from the corresponding
    mixin from imblearn.base

    Parameters
    ----------
    Estimator : class
        Class to check. Estimator is a class object (not an instance).
    """
    name = Estimator.__name__
    # test scikit-learn compatibility
    sklearn_check_estimator(Estimator)
    check_parameters_default_constructible(name, Estimator)
    for check in _yield_all_checks(name, Estimator):
        check(name, Estimator)