Skip to content

When using sklearn v0.23, some estimator checks fail #231

Closed

Description

@rtavenar

Describe the bug
It seems the way estimator tags are obtained has changed in sklearn since version 0.23 that was just released: some tests that used to pass are now failing because of missing tags.

To Reproduce
See example of failing test here.

Expected behavior
Tests should pass as they used to, since default tag value should be set.

Environment (please complete the following information):

  • scikit-learn v0.23

Activity

  1. rtavenar commented on May 15, 2020

    @rtavenar
    MemberAuthor

    @rth @GillesVandewiele any idea what could cause this? I couldn't see anything related in the changelog, and DEFAULT_TAGS still has binary_only key in sklearn master: https://github.com/scikit-learn/scikit-learn/blob/90d00daa76d1c6848a60554c7eba15f1e351ed46/sklearn/base.py#L23

  2. rth commented on May 15, 2020

    @rth
    Contributor

    So currently e.g. GlobalAlignmentKernelKMeans()._get_tags() returns {'allow_nan': True, 'allow_variable_length': True} and so it doesn't include all the default tags from the BaseEstimator. To make it work we would need instead to do define GlobalAlignmentKernelKMeans._more_tags with those values and then _get_tags would be inherited from BaseEstimator.

    Another point I think is that would make sense to run estimator tests only for one last version of scikit-learn. Estimator checks still evolve and supporting more than one version would be difficult.

    Also we should get rid of _safe_tags in tslearn in favor of just using estimator._get_tags. That's why these checks break I think, because we stopped using _safe_tags in estimator checks in scikit-learn. This may require re-ordering mixing so e.g.,

    class GlobalAlignmentKernelKMeans(BaseEstimator, BaseModelPackage, ClusterMixin):

    should be

    class GlobalAlignmentKernelKMeans(ClusterMixin, BaseModelPackage, BaseEstimator):

    because method order resolution (MRO) in python is left to right, and we want for BaseEstimator to be last. It was in the 0.22 release notes,

    |Fix| The estimators tags resolution now follows the regular MRO. They used to be overridable only once. :pr:`14884` by `Andreas Müller`_.
    

    Opened scikit-learn/scikit-learn#17232 to improve the documentation about it.

  3. rtavenar commented on May 15, 2020

    @rtavenar
    MemberAuthor

    Thanks a lot @rth for this detailed answer! I will then open a PR implementing those changes. Also, I'll need to think about how to provide default value for 'allow_variable_length' key.

  4. rtavenar commented on May 15, 2020

    @rtavenar
    MemberAuthor

    Another point I think is that would make sense to run estimator tests only for one last version of scikit-learn. Estimator checks still evolve and supporting more than one version would be difficult.

    And maybe it would also make sense to have all other tests run for our matrix of (python_versions x OS) but have estimator checks only for one configuration (Python version, OS, sklearn version)? That would save a lot of computations.

  5. rth commented on May 15, 2020

    @rth
    Contributor

    but have estimator checks only for one configuration (Python version, OS, sklearn version)?

    I agree that it' probably not that useful to run them on all OS versions.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions