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
480600b3
Unverified
Commit
480600b3
authored
Dec 16, 2024
by
James Lamb
Committed by
GitHub
Dec 16, 2024
Browse files
[python-package] simplify eval result printing (#6749)
Co-authored-by:
José Morales
<
jmoralz92@gmail.com
>
parent
8eb3c3c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
python-package/lightgbm/callback.py
python-package/lightgbm/callback.py
+7
-9
No files found.
python-package/lightgbm/callback.py
View file @
480600b3
...
...
@@ -73,15 +73,13 @@ class CallbackEnv:
def
_format_eval_result
(
value
:
_EvalResultTuple
,
show_stdv
:
bool
)
->
str
:
"""Format metric string."""
if
len
(
value
)
==
4
:
return
f
"
{
value
[
0
]
}
's
{
value
[
1
]
}
:
{
value
[
2
]:
g
}
"
elif
len
(
value
)
==
5
:
if
show_stdv
:
return
f
"
{
value
[
0
]
}
's
{
value
[
1
]
}
:
{
value
[
2
]:
g
}
+
{
value
[
4
]:
g
}
"
# type: ignore[misc]
else
:
return
f
"
{
value
[
0
]
}
's
{
value
[
1
]
}
:
{
value
[
2
]:
g
}
"
else
:
raise
ValueError
(
"Wrong metric value"
)
dataset_name
,
metric_name
,
metric_value
,
*
_
=
value
out
=
f
"
{
dataset_name
}
's
{
metric_name
}
:
{
metric_value
:
g
}
"
# tuples from cv() sometimes have a 5th item, with standard deviation of
# the evaluation metric (taken over all cross-validation folds)
if
show_stdv
and
len
(
value
)
==
5
:
out
+=
f
" +
{
value
[
4
]:
g
}
"
return
out
class
_LogEvaluationCallback
:
...
...
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