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
804d3ada
Commit
804d3ada
authored
Oct 27, 2016
by
Guolin Ke
Browse files
clean code.
parent
df78bb3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
include/LightGBM/config.h
include/LightGBM/config.h
+0
-1
include/LightGBM/utils/lru_pool.h
include/LightGBM/utils/lru_pool.h
+7
-5
src/io/config.cpp
src/io/config.cpp
+0
-1
src/treelearner/serial_tree_learner.cpp
src/treelearner/serial_tree_learner.cpp
+7
-6
No files found.
include/LightGBM/config.h
View file @
804d3ada
...
...
@@ -94,7 +94,6 @@ public:
std
::
string
input_model
=
""
;
std
::
string
input_init_score
=
""
;
int
verbosity
=
1
;
std
::
string
log_file
=
""
;
int
num_model_predict
=
-
1
;
bool
is_pre_partition
=
false
;
bool
is_enable_sparse
=
true
;
...
...
include/LightGBM/utils/lru_pool.h
View file @
804d3ada
...
...
@@ -5,6 +5,7 @@
#include <LightGBM/utils/log.h>
#include <cstring>
#include <functional>
namespace
LightGBM
{
...
...
@@ -66,12 +67,13 @@ public:
}
/*!
* \brief Set data for the pool for specific index
* \param idx which index want to set to
* \param data
* \brief Fill the pool
* \param obj_create_fun that used to generate object
*/
void
Set
(
int
idx
,
const
T
&
data
)
{
pool_
[
idx
]
=
data
;
void
Fill
(
std
::
function
<
T
()
>
obj_create_fun
)
{
for
(
int
i
=
0
;
i
<
cache_size_
;
++
i
)
{
pool_
[
i
]
=
obj_create_fun
();
}
}
/*!
...
...
src/io/config.cpp
View file @
804d3ada
...
...
@@ -159,7 +159,6 @@ void IOConfig::Set(const std::unordered_map<std::string, std::string>& params) {
GetString
(
params
,
"input_model"
,
&
input_model
);
GetString
(
params
,
"output_result"
,
&
output_result
);
GetString
(
params
,
"input_init_score"
,
&
input_init_score
);
GetString
(
params
,
"log_file"
,
&
log_file
);
std
::
string
tmp_str
=
""
;
if
(
GetString
(
params
,
"valid_data"
,
&
tmp_str
))
{
valid_data_filenames
=
Common
::
Split
(
tmp_str
.
c_str
(),
','
);
...
...
src/treelearner/serial_tree_learner.cpp
View file @
804d3ada
...
...
@@ -63,16 +63,17 @@ void SerialTreeLearner::Init(const Dataset* train_data) {
max_cache_size
=
Common
::
Min
(
max_cache_size
,
num_leaves_
);
histogram_pool_
.
ResetSize
(
max_cache_size
,
num_leaves_
);
for
(
int
i
=
0
;
i
<
max_cache_size
;
++
i
)
{
auto
histogram_create_function
=
[
this
](
)
{
FeatureHistogram
*
tmp_histogram_array
=
new
FeatureHistogram
[
train_data_
->
num_features
()];
for
(
int
j
=
0
;
j
<
train_data_
->
num_features
();
++
j
)
{
tmp_histogram_array
[
j
].
Init
(
train_data_
->
FeatureAt
(
j
),
j
,
min_num_data_one_leaf_
,
min_sum_hessian_one_leaf_
);
j
,
min_num_data_one_leaf_
,
min_sum_hessian_one_leaf_
);
}
// set data at i-th position
histogram_pool_
.
Set
(
i
,
tmp_histogram_array
);
}
return
tmp_histogram_array
;
};
histogram_pool_
.
Fill
(
histogram_create_function
);
// push split information for all leaves
for
(
int
i
=
0
;
i
<
num_leaves_
;
++
i
)
{
best_split_per_leaf_
.
push_back
(
SplitInfo
());
...
...
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