Skip to content

Conversation

@PharmCat
Copy link

I don't know is it bug or feature, but this code doesn't work with 0.7.8:

using StatsModels, CategoricalArrays
data = (a = [1,2,3], b = ["2", "2", "3"], c=categorical([1,2,3]))
c1 = Dict(:a => StatsModels.FullDummyCoding())
c2 = Dict(:b => StatsModels.FullDummyCoding())
c3 = Dict(:c => StatsModels.FullDummyCoding())
StatsModels.schema(data, c1) # Fine
StatsModels.schema(data, c2) # Fine
StatsModels.schema(data, c3) # ERROR

with this fix it seems work... see #330 for details. If this PR is not relevant - just delete.


ContrastsMatrix(C::FullDummyCoding, levels::AbstractVector{T}) where {T} =
ContrastsMatrix(Matrix(1.0I, length(levels), length(levels)), levels, levels, C)
ContrastsMatrix(Matrix(1.0I, length(levels), length(levels)), Vector(levels), Vector(levels), C)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ContrastsMatrix(Matrix(1.0I, length(levels), length(levels)), Vector(levels), Vector(levels), C)
ContrastsMatrix(Matrix(1.0I, length(levels), length(levels)), collect(levels), collect(levels), C)

Copy link
Author

Choose a reason for hiding this comment

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

seems collect doesn't work with Categorical 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants