Skip to content

Failure on predicting class prob from multinom_reg() with penalty #234

Closed
@DavisVaughan

Description

@DavisVaughan
library(parsnip)

mod <- multinom_reg(penalty = 0.01)
mod <- set_engine(mod, "glmnet")

fit <- fit(mod, Species ~ Sepal.Length + Sepal.Width, iris)

predict(fit, iris, type = "prob")
#> Error: `predict()` doesn't work with multiple penalties (i.e. lambdas). Please specify a single value using `penalty = some_value` or use `multi_predict()` to get multiple predictions per row of data.

Created on 2019-11-11 by the reprex package (v0.3.0.9000)

The failure is in this part of parsnip:::predict_classprob.model_fit()

new_data <- object$spec$method$pred$prob$pre(new_data, object)

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