This commit is contained in:
James Lamb 2024-09-16 11:32:51 -05:00
Родитель d715311f3a
Коммит c4ec9a4939
Не найден ключ, соответствующий данной подписи
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -662,6 +662,10 @@ class LGBMModel(_LGBMModelBase):
self._n_classes: int = -1 self._n_classes: int = -1
self.set_params(**kwargs) self.set_params(**kwargs)
# scikit-learn 1.6 introduced an __sklearn__tags() method intended to replace _more_tags().
# _more_tags() can be removed whenever lightgbm's minimum supported scikit-learn version
# is >=1.6.
# ref: https://github.com/microsoft/LightGBM/pull/6651
def _more_tags(self) -> Dict[str, Any]: def _more_tags(self) -> Dict[str, Any]:
return { return {
"allow_nan": True, "allow_nan": True,
@ -674,10 +678,6 @@ class LGBMModel(_LGBMModelBase):
} }
def __sklearn_tags__(self): def __sklearn_tags__(self):
# scikit-learn 1.6 introduced an __sklearn__tags() method intended to replace _more_tags().
# _more_tags() can be removed whenever lightgbm's minimum supported scikit-learn version
# is >=1.6.
# ref: https://github.com/microsoft/LightGBM/pull/6651
tags = super().__sklearn_tags__() tags = super().__sklearn_tags__()
more_tags = self._more_tags() more_tags = self._more_tags()
tags.input_tags.allow_nan = more_tags["allow_nan"] tags.input_tags.allow_nan = more_tags["allow_nan"]