Closed joranE closed 1 year ago
Thanks for the report, @joranE ! That's a bug, the dimensions get dropped and incorrectly reconstructed here:
This also affects predictions for a single penalty value
library(poissonreg)
#> Loading required package: parsnip
m <- poisson_reg() %>%
set_engine("glmnet") %>%
fit(count ~ (.)^2, data = seniors[,2:4])
multi_predict(m, new_data = seniors[1:2,])
#> # A tibble: 2 × 1
#> .pred
#> <list>
#> 1 <tibble [72 × 2]>
#> 2 <tibble [72 × 2]>
multi_predict(m, new_data = seniors[1,])
#> Error in predict.glmnet(object = object$fit, newx = as.matrix(new_data[, : The number of variables in newx must be 3
predict(m, new_data = seniors[1:2,], penalty = 0.1)
#> # A tibble: 2 × 1
#> .pred
#> <dbl>
#> 1 724.
#> 2 724.
predict(m, new_data = seniors[1,], penalty = 0.1)
#> Error in predict.glmnet(object = object$fit, newx = as.matrix(new_data[, : The number of variables in newx must be 3
Created on 2022-12-19 with reprex v2.0.2
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
multi_predict()
fails onglmnet
models when passing only a single row of data.versus...
Session info: