Pull request "Adding _get_tags method for compatibility with sklearn 0.22+" by from
MERGED FROM
+
import sys
from copy import deepcopy
from six import iteritems, string_types, integer_types
@@ -86,6 +87,21 @@ def log_fixup():
yield
_reset_logger()
+_CATBOOST_SKLEARN_COMPAT_TAGS = {
+ 'non_deterministic': False,
+ 'requires_positive_X': False,
+ 'requires_positive_y': False,
+ 'X_types': ['2darray','sparse','categorical'],
+ 'poor_score': True,
+ 'no_validation': True,
+ 'multioutput': True,
+ "allow_nan": True,
+ 'stateless': False,
+ 'multilabel': False,
+ '_skip_test': False,
+ 'multioutput_only': False,
+ 'binary_only': False,
+ 'requires_fit': True}
def _cast_to_base_types(value):
# NOTE: Special case, avoiding new list creation.
@@ -1438,6 +1454,13 @@ class _CatBoostBase(object):
'''
self._object._set_feature_names(feature_names)
+
+ def _get_tags(self):
+ tags = _CATBOOST_SKLEARN_COMPAT_TAGS
+ if self._init_params['task_type'] == 'GPU':
+ tags['non_deterministic'] = True
+ return tags
+
def get_scale_and_bias(self):
return self._object._get_scale_and_bias()
