Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

predict for Multinomial models with type = "class" #101

Open
davidruegamer opened this issue Apr 26, 2019 · 0 comments
Open

predict for Multinomial models with type = "class" #101

davidruegamer opened this issue Apr 26, 2019 · 0 comments

Comments

@davidruegamer
Copy link
Member

davidruegamer commented Apr 26, 2019

library(mboost)

myiris <- as.list(iris)
myiris$class <- factor(levels(iris$Species)[-nlevels(iris$Species)])

## Now fit the linear array model
mlm <- mboost(Species ~ bols(Sepal.Length, df = 2) %O%
                bols(class, df = 2, contrasts.arg = "contr.dummy"),
              data = myiris,
              family = Multinomial())

# works
predict(mlm)
# gives weird error message
predict(mlm, type = "class")

If type = "class" is something we won't be able to fix, we should at least return a meaningful error message.
(Quick) fix:

apply(predict(mlm, type = "response"),1,which.max)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant