Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
452370ac
"googlemock/git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "5bae126d663ee470357216f6c64410de3bab4723"
Unverified
Commit
452370ac
authored
May 16, 2023
by
James Lamb
Committed by
GitHub
May 15, 2023
Browse files
[ci] [python-package] fix mypy errors in sklearn.py (#5886)
parent
0957ab72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
python-package/lightgbm/sklearn.py
python-package/lightgbm/sklearn.py
+8
-4
No files found.
python-package/lightgbm/sklearn.py
View file @
452370ac
...
@@ -746,9 +746,13 @@ class LGBMModel(_LGBMModelBase):
...
@@ -746,9 +746,13 @@ class LGBMModel(_LGBMModelBase):
# Do not modify original args in fit function
# Do not modify original args in fit function
# Refer to https://github.com/microsoft/LightGBM/pull/2619
# Refer to https://github.com/microsoft/LightGBM/pull/2619
eval_metric_list
=
copy
.
deepcopy
(
eval_metric
)
eval_metric_list
:
List
[
Union
[
str
,
_LGBM_ScikitCustomEvalFunction
]]
if
not
isinstance
(
eval_metric_list
,
list
):
if
eval_metric
is
None
:
eval_metric_list
=
[
eval_metric_list
]
eval_metric_list
=
[]
elif
isinstance
(
eval_metric
,
list
):
eval_metric_list
=
copy
.
deepcopy
(
eval_metric
)
else
:
eval_metric_list
=
[
copy
.
deepcopy
(
eval_metric
)]
# Separate built-in from callable evaluation metrics
# Separate built-in from callable evaluation metrics
eval_metrics_callable
=
[
_EvalFunctionWrapper
(
f
)
for
f
in
eval_metric_list
if
callable
(
f
)]
eval_metrics_callable
=
[
_EvalFunctionWrapper
(
f
)
for
f
in
eval_metric_list
if
callable
(
f
)]
...
@@ -956,7 +960,7 @@ class LGBMModel(_LGBMModelBase):
...
@@ -956,7 +960,7 @@ class LGBMModel(_LGBMModelBase):
""":obj:`str` or :obj:`callable`: The concrete objective used while fitting this model."""
""":obj:`str` or :obj:`callable`: The concrete objective used while fitting this model."""
if
not
self
.
__sklearn_is_fitted__
():
if
not
self
.
__sklearn_is_fitted__
():
raise
LGBMNotFittedError
(
'No objective found. Need to call fit beforehand.'
)
raise
LGBMNotFittedError
(
'No objective found. Need to call fit beforehand.'
)
return
self
.
_objective
return
self
.
_objective
# type: ignore[return-value]
@
property
@
property
def
n_estimators_
(
self
)
->
int
:
def
n_estimators_
(
self
)
->
int
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment