Skip to content
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

Merged
merged 14 commits into from
Nov 2, 2019
Merged

Fix xgboost label inv in binary settings #2644

merged 14 commits into from
Nov 2, 2019

Conversation

pat-s
Copy link
Member

@pat-s pat-s commented Oct 2, 2019

@pat-s
Copy link
Member Author

pat-s commented Oct 7, 2019

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)
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

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.

@pat-s
Copy link
Member Author

pat-s commented Oct 15, 2019

@berndbischl @mllg

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.

@pat-s
Copy link
Member Author

pat-s commented Oct 27, 2019

I am not quite sure what's going on currently with all the tolerance problems (see also #2667) but other than that I'd say we're ready to merge.

@mllg

@pat-s pat-s merged commit 3f2d227 into master Nov 2, 2019
@pat-s pat-s deleted the xgboost-label-inv branch November 2, 2019 08:17
vrodriguezf pushed a commit to vrodriguezf/mlr that referenced this pull request Jan 16, 2021
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants