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
c79d897c
Commit
c79d897c
authored
Jul 17, 2017
by
Laurae
Committed by
Guolin Ke
Jul 17, 2017
Browse files
Custom evaluation metric gets values as non-raw (#697)
parent
1da24a45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
R-package/demo/early_stopping.R
R-package/demo/early_stopping.R
+1
-1
No files found.
R-package/demo/early_stopping.R
View file @
c79d897c
...
@@ -34,7 +34,7 @@ logregobj <- function(preds, dtrain) {
...
@@ -34,7 +34,7 @@ logregobj <- function(preds, dtrain) {
# Take this in mind when you use the customization, and maybe you need write customized evaluation function
# Take this in mind when you use the customization, and maybe you need write customized evaluation function
evalerror
<-
function
(
preds
,
dtrain
)
{
evalerror
<-
function
(
preds
,
dtrain
)
{
labels
<-
getinfo
(
dtrain
,
"label"
)
labels
<-
getinfo
(
dtrain
,
"label"
)
err
<-
as.numeric
(
sum
(
labels
!=
(
preds
>
0
)))
/
length
(
labels
)
err
<-
as.numeric
(
sum
(
labels
!=
(
preds
>
0
.5
)))
/
length
(
labels
)
return
(
list
(
name
=
"error"
,
value
=
err
,
higher_better
=
FALSE
))
return
(
list
(
name
=
"error"
,
value
=
err
,
higher_better
=
FALSE
))
}
}
print
(
"Start training with early Stopping setting"
)
print
(
"Start training with early Stopping setting"
)
...
...
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