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
ac37bf8a
"vscode:/vscode.git/clone" did not exist on "1862d7f53b8031e5d004f5d602545ed5ff5e95bb"
Unverified
Commit
ac37bf8a
authored
Apr 24, 2023
by
James Lamb
Committed by
GitHub
Apr 24, 2023
Browse files
[ci] [python-package] fix mypy error about return_cvbooster in cv() (#5845)
parent
f74875ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
python-package/lightgbm/engine.py
python-package/lightgbm/engine.py
+3
-3
No files found.
python-package/lightgbm/engine.py
View file @
ac37bf8a
...
...
@@ -545,7 +545,7 @@ def cv(
callbacks
:
Optional
[
List
[
Callable
]]
=
None
,
eval_train_metric
:
bool
=
False
,
return_cvbooster
:
bool
=
False
)
->
Dict
[
str
,
Any
]:
)
->
Dict
[
str
,
Union
[
List
[
float
],
CVBooster
]
]:
"""Perform the cross-validation with given parameters.
Parameters
...
...
@@ -651,7 +651,7 @@ def cv(
{'metric1-mean': [values], 'metric1-stdv': [values],
'metric2-mean': [values], 'metric2-stdv': [values],
...}.
If ``return_cvbooster=True``, also returns trained boosters via ``cvbooster`` key.
If ``return_cvbooster=True``, also returns trained boosters
wrapped in a ``CVBooster`` object
via ``cvbooster`` key.
"""
if
not
isinstance
(
train_set
,
Dataset
):
raise
TypeError
(
f
"cv() only accepts Dataset object, train_set has type '
{
type
(
train_set
).
__name__
}
'."
)
...
...
@@ -763,6 +763,6 @@ def cv(
break
if
return_cvbooster
:
results
[
'cvbooster'
]
=
cvfolds
results
[
'cvbooster'
]
=
cvfolds
# type: ignore[assignment]
return
dict
(
results
)
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