Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-package] add type hints on feature_name and categorical_feature in sklearn interface #5747

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions python-package/lightgbm/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import numpy as np

from .basic import (Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType,
_LGBM_EvalFunctionResultType, _log_warning)
_LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_FeatureNameConfiguration,
_log_warning)
from .callback import _EvalResultDict, record_evaluation
from .compat import (SKLEARN_INSTALLED, LGBMNotFittedError, _LGBMAssertAllFinite, _LGBMCheckArray,
_LGBMCheckClassificationTargets, _LGBMCheckSampleWeight, _LGBMCheckXY, _LGBMClassifierBase,
Expand Down Expand Up @@ -708,8 +709,8 @@ def fit(
eval_init_score=None,
eval_group=None,
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
feature_name='auto',
categorical_feature='auto',
feature_name: _LGBM_FeatureNameConfiguration = 'auto',
categorical_feature: _LGBM_CategoricalFeatureConfiguration = 'auto',
callbacks=None,
init_model: Optional[Union[str, Path, Booster, "LGBMModel"]] = None
):
Expand Down Expand Up @@ -999,8 +1000,8 @@ def fit( # type: ignore[override]
eval_sample_weight=None,
eval_init_score=None,
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
feature_name='auto',
categorical_feature='auto',
feature_name: _LGBM_FeatureNameConfiguration = 'auto',
categorical_feature: _LGBM_CategoricalFeatureConfiguration = 'auto',
callbacks=None,
init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None
):
Expand Down Expand Up @@ -1046,8 +1047,8 @@ def fit( # type: ignore[override]
eval_class_weight=None,
eval_init_score=None,
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
feature_name='auto',
categorical_feature='auto',
feature_name: _LGBM_FeatureNameConfiguration = 'auto',
categorical_feature: _LGBM_CategoricalFeatureConfiguration = 'auto',
callbacks=None,
init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None
):
Expand Down Expand Up @@ -1216,8 +1217,8 @@ def fit( # type: ignore[override]
eval_group=None,
eval_metric: Optional[_LGBM_ScikitEvalMetricType] = None,
eval_at: Union[List[int], Tuple[int, ...]] = (1, 2, 3, 4, 5),
feature_name='auto',
categorical_feature='auto',
feature_name: _LGBM_FeatureNameConfiguration = 'auto',
categorical_feature: _LGBM_CategoricalFeatureConfiguration = 'auto',
callbacks=None,
init_model: Optional[Union[str, Path, Booster, LGBMModel]] = None
):
Expand Down