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
381a945d
Commit
381a945d
authored
Dec 23, 2016
by
Guolin Ke
Browse files
fix bug in GetPredictAt for multi class
parent
8aa15e88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
src/boosting/gbdt.cpp
src/boosting/gbdt.cpp
+3
-4
No files found.
src/boosting/gbdt.cpp
View file @
381a945d
...
...
@@ -388,7 +388,6 @@ const score_t* GBDT::GetTrainingScore(data_size_t* out_len) {
void
GBDT
::
GetPredictAt
(
int
data_idx
,
score_t
*
out_result
,
data_size_t
*
out_len
)
{
CHECK
(
data_idx
>=
0
&&
data_idx
<=
static_cast
<
int
>
(
valid_metrics_
.
size
()));
std
::
vector
<
double
>
ret
;
const
score_t
*
raw_scores
=
nullptr
;
data_size_t
num_data
=
0
;
...
...
@@ -404,13 +403,13 @@ void GBDT::GetPredictAt(int data_idx, score_t* out_result, data_size_t* out_len)
if
(
num_class_
>
1
)
{
#pragma omp parallel for schedule(static)
for
(
data_size_t
i
=
0
;
i
<
num_data
;
++
i
)
{
std
::
vector
<
double
>
tmp_result
;
std
::
vector
<
double
>
tmp_result
(
num_class_
)
;
for
(
int
j
=
0
;
j
<
num_class_
;
++
j
)
{
tmp_result
.
push_back
(
raw_scores
[
j
*
num_data
+
i
]
)
;
tmp_result
[
j
]
=
raw_scores
[
j
*
num_data
+
i
];
}
Common
::
Softmax
(
&
tmp_result
);
for
(
int
j
=
0
;
j
<
num_class_
;
++
j
)
{
out_result
[
j
*
num_data
+
i
]
=
static_cast
<
score_t
>
(
tmp_result
[
i
]);
out_result
[
j
*
num_data
+
i
]
=
static_cast
<
score_t
>
(
tmp_result
[
j
]);
}
}
}
else
if
(
sigmoid_
>
0.0
f
){
...
...
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