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
ea37b10b
Commit
ea37b10b
authored
Apr 22, 2017
by
Zeeshan Siddiqui
Committed by
Guolin Ke
Apr 22, 2017
Browse files
Prevent memory corruption when multi-class dataset is passed for binary light GBM (#444)
parent
8bf1297a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/boosting/gbdt.cpp
src/boosting/gbdt.cpp
+4
-1
No files found.
src/boosting/gbdt.cpp
View file @
ea37b10b
...
@@ -170,7 +170,10 @@ void GBDT::ResetTrainingData(const BoostingConfig* config, const Dataset* train_
...
@@ -170,7 +170,10 @@ void GBDT::ResetTrainingData(const BoostingConfig* config, const Dataset* train_
std
::
vector
<
data_size_t
>
cnt_per_class
(
num_tree_per_iteration_
+
1
,
0
);
std
::
vector
<
data_size_t
>
cnt_per_class
(
num_tree_per_iteration_
+
1
,
0
);
auto
label
=
train_data_
->
metadata
().
label
();
auto
label
=
train_data_
->
metadata
().
label
();
for
(
int
i
=
0
;
i
<
num_data_
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_data_
;
++
i
)
{
++
cnt_per_class
[
static_cast
<
int
>
(
label
[
i
])];
int
index
=
static_cast
<
int
>
(
label
[
i
]);
//Check if user gave a multi-class dataset for a binary class problem.
if
(
index
<=
num_tree_per_iteration_
)
++
cnt_per_class
[
static_cast
<
int
>
(
label
[
i
])];
}
}
if
(
num_tree_per_iteration_
>
1
)
{
if
(
num_tree_per_iteration_
>
1
)
{
for
(
int
i
=
0
;
i
<
num_tree_per_iteration_
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_tree_per_iteration_
;
++
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