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
4398906d
Commit
4398906d
authored
Mar 29, 2017
by
Guolin Ke
Browse files
fix softmax objective.
parent
841a8987
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
src/metric/multiclass_metric.hpp
src/metric/multiclass_metric.hpp
+0
-1
src/objective/multiclass_objective.hpp
src/objective/multiclass_objective.hpp
+2
-2
No files found.
src/metric/multiclass_metric.hpp
View file @
4398906d
...
...
@@ -175,7 +175,6 @@ public:
if
(
weights_
==
nullptr
)
{
#pragma omp parallel for schedule(static) reduction(+:sum_loss)
for
(
data_size_t
i
=
0
;
i
<
num_data_
;
++
i
)
{
std
::
vector
<
double
>
rec
(
num_class_
);
size_t
idx
=
static_cast
<
size_t
>
(
num_data_
)
*
static_cast
<
int
>
(
label_
[
i
])
+
i
;
double
prob
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
sigmoid_
*
score
[
idx
]));
if
(
prob
<
kEpsilon
)
{
prob
=
kEpsilon
;
}
...
...
src/objective/multiclass_objective.hpp
View file @
4398906d
...
...
@@ -56,7 +56,7 @@ public:
}
else
{
gradients
[
idx
]
=
static_cast
<
score_t
>
(
p
);
}
hessians
[
idx
]
=
static_cast
<
score_t
>
(
p
*
(
1.0
f
-
p
));
hessians
[
idx
]
=
static_cast
<
score_t
>
(
2.0
f
*
p
*
(
1.0
f
-
p
));
}
}
}
else
{
...
...
@@ -77,7 +77,7 @@ public:
}
else
{
gradients
[
idx
]
=
static_cast
<
score_t
>
(
p
*
weights_
[
i
]);
}
hessians
[
idx
]
=
static_cast
<
score_t
>
(
p
*
(
1.0
f
-
p
)
*
weights_
[
i
]);
hessians
[
idx
]
=
static_cast
<
score_t
>
(
2.0
f
*
p
*
(
1.0
f
-
p
)
*
weights_
[
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