Unverified Commit 6ae96c96 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[python-package] add type hints on fit() return and callbacks in sklearn.py (#5748)

parent 426dfcca
...@@ -710,9 +710,9 @@ class LGBMModel(_LGBMModelBase): ...@@ -710,9 +710,9 @@ class LGBMModel(_LGBMModelBase):
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None, eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
feature_name='auto', feature_name='auto',
categorical_feature='auto', categorical_feature='auto',
callbacks=None, callbacks: Optional[List[Callable]] = None,
init_model: Optional[Union[str, Path, Booster, "LGBMModel"]] = None init_model: Optional[Union[str, Path, Booster, "LGBMModel"]] = None
): ) -> "LGBMModel":
"""Docstring is set after definition, using a template.""" """Docstring is set after definition, using a template."""
params = self._process_params(stage="fit") params = self._process_params(stage="fit")
...@@ -1001,9 +1001,9 @@ class LGBMRegressor(_LGBMRegressorBase, LGBMModel): ...@@ -1001,9 +1001,9 @@ class LGBMRegressor(_LGBMRegressorBase, LGBMModel):
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None, eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
feature_name='auto', feature_name='auto',
categorical_feature='auto', categorical_feature='auto',
callbacks=None, callbacks: Optional[List[Callable]] = None,
init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None
): ) -> "LGBMRegressor":
"""Docstring is inherited from the LGBMModel.""" """Docstring is inherited from the LGBMModel."""
super().fit( super().fit(
X, X,
...@@ -1048,9 +1048,9 @@ class LGBMClassifier(_LGBMClassifierBase, LGBMModel): ...@@ -1048,9 +1048,9 @@ class LGBMClassifier(_LGBMClassifierBase, LGBMModel):
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None, eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
feature_name='auto', feature_name='auto',
categorical_feature='auto', categorical_feature='auto',
callbacks=None, callbacks: Optional[List[Callable]] = None,
init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None
): ) -> "LGBMClassifier":
"""Docstring is inherited from the LGBMModel.""" """Docstring is inherited from the LGBMModel."""
_LGBMAssertAllFinite(y) _LGBMAssertAllFinite(y)
_LGBMCheckClassificationTargets(y) _LGBMCheckClassificationTargets(y)
...@@ -1218,9 +1218,9 @@ class LGBMRanker(LGBMModel): ...@@ -1218,9 +1218,9 @@ class LGBMRanker(LGBMModel):
eval_at: Union[List[int], Tuple[int, ...]] = (1, 2, 3, 4, 5), eval_at: Union[List[int], Tuple[int, ...]] = (1, 2, 3, 4, 5),
feature_name='auto', feature_name='auto',
categorical_feature='auto', categorical_feature='auto',
callbacks=None, callbacks: Optional[List[Callable]] = None,
init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None
): ) -> "LGBMRanker":
"""Docstring is inherited from the LGBMModel.""" """Docstring is inherited from the LGBMModel."""
# check group data # check group data
if group is None: if group is None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment