Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Julia is a one-indexed language; so, when the user gives us labels from Julia, we expect them to be in the range
[1, numClasses]
. Internally, we must map them to[0, numClasses - 1]
when passing to mlpack, since mlpack and Armadillo are zero-indexed and that is our convention. For labels, this works just fine.When we pass categorical data, we have the same one-indexed expectation from Julia: the Julia user will give us a
Matrix{Float64}
as well as aVector{Bool}
. The boolean vector specifies which dimensions are categorical, and then those dimensions in theMatrix{Float64}
should take values in[1, numCategories]
. Here, we must also do the same transformation to[0, numCategories - 1]
.However, that transformation was not implemented, which caused the failure in #3300.
This PR fixes the problem, by subtracting one from any categorical dimensions before passing the data into mlpack.