8000 More generic estimator checks · Issue #14712 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
More generic estimator checks #14712
@raamana

Description

@raamana

Description

While trying to roll my own estimator as part of kernelmethods, I ran into a failed estimator check check_non_transformer_estimators_n_iter.

This function is not supposed to run the check (as my estimator is derived from SVR) according to code below:

    # These models are dependent on external solvers like
    # libsvm and accessing the iter parameter is non-trivial.
    not_run_check_n_iter = ['Ridge', 'SVR', 'NuSVR', 'NuSVC',
                            'RidgeClassifier', 'SVC', 'RandomizedLasso',
                            'LogisticRegressionCV', 'LinearSVC',
                            'LogisticRegression']

    # Tested in test_transformer_n_iter
    not_run_check_n_iter += CROSS_DECOMPOSITION
    if name in not_run_check_n_iter:
        return

However, given my estimator name (OptimalKernelSVR) is not actually in the list, it goes ahead and runs the check which is irrelevant to my estimator. To prevent this, I suggest making these checks less specific to sklearn's native estimators and more amenable to external libraries. Some possible solutions are:

  1. change if name in not_run_check_n_iter: to
for no_test_name in not_run_check_n_iter:
    if name.lower() in no_test_name.lower():
        return 
  1. Allow passing some flags to check_estimator skip a specific test in here

Steps/Code to Reproduce

  1. Clone and install kernelmethods in dev mode

  2. Run this code

from kernelmethods.algorithms import OptimalKernelSVR
from sklearn.utils.estimator_checks import check_estimator
OKSVR = OptimalKernelSVR(k_bucket='light')
check_estimator(OKSVR)

Versions

System:
    python: 3.7.2 (default, Dec 29 2018, 00:00:04)  [Clang 4.0.1 (tags/RELEASE_401/final)]
executable: /Users/Reddy/anaconda3/envs/py36/bin/python
   machine: Darwin-18.6.0-x86_64-i386-64bit
BLAS:
    macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
  lib_dirs: /Users/Reddy/anaconda3/envs/py36/lib
cblas_libs: mkl_rt, pthread
Python deps:
       pip: 19.1.1
setuptools: 41.0.1
   sklearn: 0.21.2
     numpy: 1.15.4
     scipy: 1.1.0
    Cython: None
    pandas: 0.24.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIDeveloper APIThird party developer API related

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0