glmnet LASSO can´t handle missing values in tidymodels?

In glmnet, when you have missing values in the predictor, you get the message " Error in cbind2(1, newx) % % nbeta: invalid class 'NA' to dup_mMatrix_as_dgeMatri". What I run the following in tidymodels: last_fit(object = best_workflow, split = split, metrics = metrics)

where the workflow contains a LASSO model I get the same message: x Resample1: model (predictions): Error in cbind2(1, newx) %* % nbeta: invalid class 'NA' to dup_mMatrix_as_dgeMatrix Warning message: All models failed in [fit_resamples()]. See the .notes column. Advice would highly appreciated!

A note about cross posting: Is it OK if I cross-post?
Cross post:

Sorry. My mistake as this is my very first post. I removed it on stackoverflow. Thanks

I solved it. It was because I had defined the categorical predictors as factors. Then it didn´t work. When I did not defined them as factors it worked well.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.