Skip to content

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

Description

@davidruegamer
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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions