Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFailure on predicting class prob from `multinom_reg()` with penalty #234
Comments
|
Done! 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")
#> # A tibble: 150 x 3
#> .pred_setosa .pred_versicolor .pred_virginica
#> <dbl> <dbl> <dbl>
#> 1 0.978 0.0181 0.00390
#> 2 0.872 0.114 0.0136
#> 3 0.984 0.0146 0.00140
#> 4 0.983 0.0160 0.00124
#> 5 0.993 0.00619 0.00120
#> 6 0.989 0.00767 0.00335
#> 7 0.997 0.00277 0.000250
#> 8 0.977 0.0198 0.00344
#> 9 0.980 0.0192 0.000962
#> 10 0.925 0.0669 0.00843
#> # … with 140 more rowsCreated on 2019-12-01 by the reprex package (v0.3.0) |
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()parsnip/R/predict_classprob.R
Line 25 in 74ff766