-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Labels
featurea feature request or enhancementa feature request or enhancement
Description
library(parsnip)
set.seed(1234)
predictrs <- matrix(rnorm(100*20), ncol = 20)
response <- as.factor(sample(1:4, 100, replace = TRUE))
fit <- multinom_reg() %>%
set_engine("glmnet") %>%
fit_xy(x = predictrs, y = response)
#> Error in glmnet::glmnet(x = maybe_matrix(x), y = y, family = "multinomial"): x should be a matrix with 2 or more columns
#> Timing stopped at: 0.002 0 0.002
Found while looking at some butcher test failures
Traced the issue to here:
Lines 69 to 71 in 375e310
if (remove_intercept) { | |
env$x <- env$x[, colnames(env$x) != "(Intercept)", drop = FALSE] | |
} |
because there are no column names, colnames(env$x) != "(Intercept)"
evaluates to logical(0)
, so we select 0 columns here. So then we eventually get the error message of x should be a matrix with 2 or more columns
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement