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
e6de39a7
Unverified
Commit
e6de39a7
authored
Mar 30, 2020
by
Nikita Titov
Committed by
GitHub
Mar 30, 2020
Browse files
fix inf in json model dump (#2940)
parent
7c2958cd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
src/boosting/gbdt_model_text.cpp
src/boosting/gbdt_model_text.cpp
+6
-2
No files found.
src/boosting/gbdt_model_text.cpp
View file @
e6de39a7
...
...
@@ -48,8 +48,12 @@ std::string GBDT::DumpModel(int start_iteration, int num_iteration) const {
if
(
strs
[
0
][
0
]
==
'['
)
{
strs
[
0
].
erase
(
0
,
1
);
// remove '['
strs
[
1
].
erase
(
strs
[
1
].
size
()
-
1
);
// remove ']'
json_str_buf
<<
"{
\"
min_value
\"
:"
<<
strs
[
0
]
<<
","
;
json_str_buf
<<
"
\"
max_value
\"
:"
<<
strs
[
1
]
<<
","
;
double
max_
,
min_
;
Common
::
Atof
(
strs
[
0
].
c_str
(),
&
min_
);
Common
::
Atof
(
strs
[
1
].
c_str
(),
&
max_
);
json_str_buf
<<
std
::
setprecision
(
std
::
numeric_limits
<
double
>::
digits10
+
2
);
json_str_buf
<<
"{
\"
min_value
\"
:"
<<
Common
::
AvoidInf
(
min_
)
<<
","
;
json_str_buf
<<
"
\"
max_value
\"
:"
<<
Common
::
AvoidInf
(
max_
)
<<
","
;
json_str_buf
<<
"
\"
values
\"
:[]}"
;
}
else
if
(
strs
[
0
]
!=
"none"
)
{
// categorical feature
auto
vals
=
Common
::
StringToArray
<
int
>
(
feature_infos_
[
i
],
':'
);
...
...
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