Skip to content

Scikit-learn 1.8 'CatBoostRegressor' object has no attribute '__sklearn_tags__'. #1388

@jakimowb

Description

@jakimowb

The recent upgrade of scikit-learn to 1.8 introduced errors like:

Traceback (most recent call last):
  File "/usr/src/enmapbox/typeguard/__init__.py", line 1033, in wrapper
    retval = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/enmapboxprocessing/algorithm/fitregressoralgorithmbase.py", line 101, in processAlgorithm
    regressor.fit(dump.X, dumpY)
  File "/opt/virtualenvs/enmapbox/lib/python3.12/site-packages/sklearn/base.py", line 1336, in wrapper
    return fit_method(estimator, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/virtualenvs/enmapbox/lib/python3.12/site-packages/sklearn/multioutput.py", line 242, in fit
    y = validate_data(self, X="no_validation", y=y, multi_output=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/virtualenvs/enmapbox/lib/python3.12/site-packages/sklearn/utils/validation.py", line 2878, in validate_data
    tags = get_tags(_estimator)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/virtualenvs/enmapbox/lib/python3.12/site-packages/sklearn/utils/_tags.py", line 283, in get_tags
    raise AttributeError(
AttributeError: The following error was raised: The following error was raised: 'CatBoostRegressor' object has no attribute '__sklearn_tags__'. It seems that there are no classes that implement `__sklearn_tags__` in the MRO and/or all classes in the MRO call `super().__sklearn_tags__()`. Make sure to inherit from `BaseEstimator` which implements `__sklearn_tags__` (or alternatively define `__sklearn_tags__` but we don't recommend this approach). Note that `BaseEstimator` needs to be on the right side of other Mixins in the inheritance order.. It seems that there are no classes that implement `__sklearn_tags__` in the MRO and/or all classes in the MRO call `super().__sklearn_tags__()`. Make sure to inherit from `BaseEstimator` which implements `__sklearn_tags__` (or alternatively define `__sklearn_tags__` but we don't recommend this approach). Note that `BaseEstimator` needs to be on the right side of other Mixins in the inheritance order.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions