-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix xgboost label inv in binary settings #2644
Conversation
ping @mllg |
@@ -63,9 +63,10 @@ trainLearner.classif.xgboost = function(.learner, .task, .subset, .weights = NUL | |||
td = getTaskDesc(.task) | |||
parlist = list(...) | |||
nc = length(td$class.levels) | |||
nlvls = length(td$class.levels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups 👍
@@ -79,6 +80,10 @@ trainLearner.classif.xgboost = function(.learner, .task, .subset, .weights = NUL | |||
|
|||
task.data = getTaskData(.task, .subset, target.extra = TRUE) | |||
label = match(as.character(task.data$target), td$class.levels) - 1 | |||
|
|||
# recode to 0:1 to that for the binary case the positive class translates to 1 (https://github.com/mlr-org/mlr3learners/issues/32) | |||
# task.data$target is guaranteed to have the factor levels in the right order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you doubled checked that this holds for mlr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Also the tests should ensure this.
The error we're getting in the tests is really weird. I see no change that would affect a change of probs in the following way: ── 1. Failure: classif_xgboost (@test_classif_xgboost.R#58) ───────────────────
`p` not equal to `old.probs`.
87/107 mismatches (average diff: 2.98e-08)
[1] 0.371 - 0.371 == 2.98e-08
[2] 0.371 - 0.371 == 2.98e-08
[3] 0.371 - 0.371 == 2.98e-08
[4] 0.371 - 0.371 == 2.98e-08
[5] 0.371 - 0.371 == 2.98e-08
[6] 0.371 - 0.371 == 2.98e-08
[7] 0.371 - 0.371 == 2.98e-08
[8] 0.371 - 0.371 == 2.98e-08
[9] 0.371 - 0.371 == 2.98e-08 Would you mind taking a look? Thanks. |
* fix xgboost inv label issue * upd NEWS * revert regrLearner * add tolerance value for test * Deploy from Travis build 14334 [ci skip] Build URL: https://travis-ci.org/mlr-org/mlr/builds/603356026 Commit: 00731c7
See mlr-org/mlr3learners#32
cc @001ben