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
9653938a
Commit
9653938a
authored
Nov 21, 2016
by
Guolin Ke
Browse files
some warning fixed
parent
d6ef6cfa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
10 deletions
+16
-10
include/LightGBM/config.h
include/LightGBM/config.h
+1
-1
include/LightGBM/utils/common.h
include/LightGBM/utils/common.h
+7
-1
include/LightGBM/utils/pipeline_reader.h
include/LightGBM/utils/pipeline_reader.h
+1
-1
src/io/config.cpp
src/io/config.cpp
+6
-6
src/io/ordered_sparse_bin.hpp
src/io/ordered_sparse_bin.hpp
+1
-1
No files found.
include/LightGBM/config.h
View file @
9653938a
...
...
@@ -286,7 +286,7 @@ inline bool ConfigBase::GetBool(
const
std
::
string
&
name
,
bool
*
out
)
{
if
(
params
.
count
(
name
)
>
0
)
{
std
::
string
value
=
params
.
at
(
name
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
::
tolower
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
Common
::
tolower
);
if
(
value
==
std
::
string
(
"false"
)
||
value
==
std
::
string
(
"-"
))
{
*
out
=
false
;
}
else
if
(
value
==
std
::
string
(
"true"
)
||
value
==
std
::
string
(
"+"
))
{
...
...
include/LightGBM/utils/common.h
View file @
9653938a
...
...
@@ -17,6 +17,12 @@ namespace LightGBM {
namespace
Common
{
inline
char
tolower
(
char
in
)
{
if
(
in
<=
'Z'
&&
in
>=
'A'
)
return
in
-
(
'Z'
-
'z'
);
return
in
;
}
inline
static
std
::
string
&
Trim
(
std
::
string
&
str
)
{
if
(
str
.
size
()
<=
0
)
{
return
str
;
...
...
@@ -173,7 +179,7 @@ inline static const char* Atof(const char* p, double* out) {
}
if
(
cnt
>
0
)
{
std
::
string
tmp_str
(
p
,
cnt
);
std
::
transform
(
tmp_str
.
begin
(),
tmp_str
.
end
(),
tmp_str
.
begin
(),
::
tolower
);
std
::
transform
(
tmp_str
.
begin
(),
tmp_str
.
end
(),
tmp_str
.
begin
(),
Common
::
tolower
);
if
(
tmp_str
==
std
::
string
(
"na"
)
||
tmp_str
==
std
::
string
(
"nan"
))
{
*
out
=
0
;
}
else
if
(
tmp_str
==
std
::
string
(
"inf"
)
||
tmp_str
==
std
::
string
(
"infinity"
))
{
...
...
include/LightGBM/utils/pipeline_reader.h
View file @
9653938a
...
...
@@ -5,10 +5,10 @@
#include <cstdio>
#include <algorithm>
#include <functional>
#include <thread>
#include <memory>
#include <algorithm>
namespace
LightGBM
{
...
...
src/io/config.cpp
View file @
9653938a
...
...
@@ -66,7 +66,7 @@ void OverallConfig::Set(const std::unordered_map<std::string, std::string>& para
void
OverallConfig
::
GetBoostingType
(
const
std
::
unordered_map
<
std
::
string
,
std
::
string
>&
params
)
{
std
::
string
value
;
if
(
GetString
(
params
,
"boosting_type"
,
&
value
))
{
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
::
tolower
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
Common
::
tolower
);
if
(
value
==
std
::
string
(
"gbdt"
)
||
value
==
std
::
string
(
"gbrt"
))
{
boosting_type
=
BoostingType
::
kGBDT
;
}
else
if
(
value
==
std
::
string
(
"dart"
))
{
...
...
@@ -80,7 +80,7 @@ void OverallConfig::GetBoostingType(const std::unordered_map<std::string, std::s
void
OverallConfig
::
GetObjectiveType
(
const
std
::
unordered_map
<
std
::
string
,
std
::
string
>&
params
)
{
std
::
string
value
;
if
(
GetString
(
params
,
"objective"
,
&
value
))
{
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
::
tolower
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
Common
::
tolower
);
objective_type
=
value
;
}
}
...
...
@@ -91,13 +91,13 @@ void OverallConfig::GetMetricType(const std::unordered_map<std::string, std::str
// clear old metrics
metric_types
.
clear
();
// to lower
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
::
tolower
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
Common
::
tolower
);
// split
std
::
vector
<
std
::
string
>
metrics
=
Common
::
Split
(
value
.
c_str
(),
','
);
// remove dumplicate
std
::
unordered_map
<
std
::
string
,
int
>
metric_maps
;
for
(
auto
&
metric
:
metrics
)
{
std
::
transform
(
metric
.
begin
(),
metric
.
end
(),
metric
.
begin
(),
::
tolower
);
std
::
transform
(
metric
.
begin
(),
metric
.
end
(),
metric
.
begin
(),
Common
::
tolower
);
if
(
metric_maps
.
count
(
metric
)
<=
0
)
{
metric_maps
[
metric
]
=
1
;
}
...
...
@@ -114,7 +114,7 @@ void OverallConfig::GetMetricType(const std::unordered_map<std::string, std::str
void
OverallConfig
::
GetTaskType
(
const
std
::
unordered_map
<
std
::
string
,
std
::
string
>&
params
)
{
std
::
string
value
;
if
(
GetString
(
params
,
"task"
,
&
value
))
{
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
::
tolower
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
Common
::
tolower
);
if
(
value
==
std
::
string
(
"train"
)
||
value
==
std
::
string
(
"training"
))
{
task_type
=
TaskType
::
kTrain
;
}
else
if
(
value
==
std
::
string
(
"predict"
)
||
value
==
std
::
string
(
"prediction"
)
...
...
@@ -308,7 +308,7 @@ void BoostingConfig::Set(const std::unordered_map<std::string, std::string>& par
void
BoostingConfig
::
GetTreeLearnerType
(
const
std
::
unordered_map
<
std
::
string
,
std
::
string
>&
params
)
{
std
::
string
value
;
if
(
GetString
(
params
,
"tree_learner"
,
&
value
))
{
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
::
tolower
);
std
::
transform
(
value
.
begin
(),
value
.
end
(),
value
.
begin
(),
Common
::
tolower
);
if
(
value
==
std
::
string
(
"serial"
))
{
tree_learner_type
=
TreeLearnerType
::
kSerialTreeLearner
;
}
else
if
(
value
==
std
::
string
(
"feature"
)
||
value
==
std
::
string
(
"feature_parallel"
))
{
...
...
src/io/ordered_sparse_bin.hpp
View file @
9653938a
...
...
@@ -37,7 +37,7 @@ public:
data_size_t
cur_pos
=
0
;
data_size_t
i_delta
=
-
1
;
while
(
bin_data_
->
NextNonzero
(
&
i_delta
,
&
cur_pos
))
{
ordered_pair_
.
emplace_back
(
cur_pos
,
0
);
ordered_pair_
.
emplace_back
(
cur_pos
,
static_cast
<
VAL_T
>
(
0
)
);
}
ordered_pair_
.
shrink_to_fit
();
}
...
...
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