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
f3ae1c10
Commit
f3ae1c10
authored
Jun 17, 2017
by
Guolin Ke
Browse files
fix #628 (update the condition of using subset in bagging) .
parent
03ba7304
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
include/LightGBM/dataset.h
include/LightGBM/dataset.h
+4
-0
src/boosting/gbdt.cpp
src/boosting/gbdt.cpp
+10
-1
No files found.
include/LightGBM/dataset.h
View file @
f3ae1c10
...
...
@@ -444,6 +444,10 @@ public:
return
feature_groups_
[
group
]
->
bin_data_
.
get
();
}
inline
bool
FeatureGroupIsSparse
(
int
group
)
const
{
return
feature_groups_
[
group
]
->
is_sparse_
;
}
inline
BinIterator
*
FeatureIterator
(
int
i
)
const
{
const
int
group
=
feature2group_
[
i
];
const
int
sub_feature
=
feature2subfeature_
[
i
];
...
...
src/boosting/gbdt.cpp
View file @
f3ae1c10
...
...
@@ -146,8 +146,17 @@ void GBDT::ResetTrainingData(const BoostingConfig* config, const Dataset* train_
left_write_pos_buf_
.
resize
(
num_threads_
);
right_write_pos_buf_
.
resize
(
num_threads_
);
double
average_bag_rate
=
new_config
->
bagging_fraction
/
new_config
->
bagging_freq
;
int
sparse_group
=
0
;
for
(
int
i
=
0
;
i
<
train_data
->
num_feature_groups
();
++
i
)
{
if
(
train_data
->
FeatureGroupIsSparse
(
i
))
{
++
sparse_group
;
}
}
is_use_subset_
=
false
;
if
(
average_bag_rate
<=
0.5
)
{
const
int
group_threshold_usesubset
=
100
;
const
int
sparse_group_threshold_usesubset
=
train_data
->
num_feature_groups
()
/
4
;
if
(
average_bag_rate
<=
0.5
&&
(
train_data
->
num_feature_groups
()
<
group_threshold_usesubset
||
sparse_group
<
sparse_group_threshold_usesubset
))
{
tmp_subset_
.
reset
(
new
Dataset
(
bag_data_cnt_
));
tmp_subset_
->
CopyFeatureMapperFrom
(
train_data
);
is_use_subset_
=
true
;
...
...
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