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

bump compat CategoricalArrays = "0.9, 0.10"; level -> levelcode #544

Merged
merged 2 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
CategoricalArrays = "0.8.1, 0.9"
CategoricalArrays = "0.9, 0.10"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refcode doesn't exist on 0.9 IIRC. Maybe I can backport it if that's useful, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh oops.

Yes, be great if you can back port to 0.9!

ComputationalResources = "0.3"
Distributions = "0.22, 0.23, 0.24"
InvertedIndices = "1"
Expand Down
4 changes: 2 additions & 2 deletions src/interface/data_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ MMI.int(::FI, x) = throw(
MMI.int(::FI, x::Missing) = missing
MMI.int(::FI, x::AbstractArray) = int.(x)

# first line is no good because it promotes type to higher ineger type:
# first line is no good because it promotes type to larger integer type:
# MMI.int(::FI, x::CategoricalValue) = CategoricalArrays.levelcode(x)
MMI.int(::FI, x::CategoricalValue) = CategoricalArrays.level(x)
MMI.int(::FI, x::CategoricalValue) = CategoricalArrays.refcode(x)

# ------------------------------------------------------------------------
# classes
Expand Down
5 changes: 4 additions & 1 deletion test/resampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ end
@test pairs != pairs_random

# wrong target type throws error:
@test_throws Exception MLJBase.train_test_pairs(scv, rows, get.(y))
@test_throws(Exception,
MLJBase.train_test_pairs(scv,
rows,
CategoricalArrays.unwrap.(y)))

# check class distribution is preserved in a larger randomized example:
N = 30
Expand Down