-
Notifications
You must be signed in to change notification settings - Fork 34
fix boolean-as-categorical support #327
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ | |
| *.jl.mem | ||
| docs/build | ||
| Manifest.toml | ||
| Manifest-v*.toml | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -233,6 +233,12 @@ function StatsAPI.coefnames(C::AbstractContrasts, levels::AbstractVector, basein | |||||
| DataAPI.unwrap.(levels[not_base]) | ||||||
| end | ||||||
|
|
||||||
| function StatsAPI.coefnames(C::AbstractContrasts, levels::AbstractVector{Bool}, baseind::Integer) | ||||||
| not_base = [firstindex(levels):(baseind - 1); (baseind + 1):lastindex(levels)] | ||||||
| # broadcasted DataAPI.unwrap converts Vector{Bool} to BitVector | ||||||
| convert(Vector{Bool}, DataAPI.unwrap.(levels[not_base])) | ||||||
| end | ||||||
|
|
||||||
| Base.getindex(contrasts::ContrastsMatrix, rowinds, colinds) = | ||||||
| getindex(contrasts.matrix, getindex.(Ref(contrasts.invindex), rowinds), colinds) | ||||||
|
|
||||||
|
|
@@ -598,6 +604,10 @@ end | |||||
| StatsAPI.coefnames(C::HypothesisCoding, levels::AbstractVector, baseind::Int) = | ||||||
| something(C.labels, DataAPI.unwrap.(levels[1:length(levels) .!= baseind])) | ||||||
|
|
||||||
| # We need an explicit method for `AbstractVector{Bool}` to avoid an ambiguity | ||||||
| StatsAPI.coefnames(C::HypothesisCoding, levels::AbstractVector{Bool}, baseind::Int) = | ||||||
palday marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| something(C.labels, DataAPI.unwrap.(levels[1:length(levels) .!= baseind])) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether it's worth using
Suggested change
Probably doesn't really matter.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, I'll consider that next time, going with the "no change" lazy and fast option for now 😂
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very reasonable |
||||||
|
|
||||||
| DataAPI.levels(c::HypothesisCoding) = c.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.
I wonder how this compares in terms of performance to something like
or perhaps
luv 2 micro-optimize
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.
if this is your performance bottleneck ... 😂