0

I have created a glmnet model to use it with new data for predictions.

ypred <- predict(fit, newx = pred.dat, type = "class")

but it returns following error message:

Error in as.matrix(cbind2(1, newx) %*% nbeta) :
error in evaluating the argument 'x' in selecting a method for function 'as.matrix':
Error in t(.Call(Csparse_dense_crossprod, y, t(x))) :
error in evaluating the argument 'x' in selecting a method for function 't':
Error: Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90

The problem seems to sit within the new data set, but because I don't know what the error message means, so can't really fix it. Could somebody help me to point out what the issue might be? The new data set has been treated with the same script as the data used to create the model. The new data set is just much larger

dim(pred.dat) 
[1] 295919    255

so I can not simply scroll through it to identify the issue.

lmo
  • 37,904
  • 9
  • 56
  • 69
KG12
  • 77
  • 1
  • 1
  • 8
  • @ZheyuanLi :-) yes, I did relaod glmnet! – KG12 May 29 '16 at 09:19
  • @ZheyuanLi I just tried to use the pred.dat on a model that I just fitted and I get the same error. So it is within the data, I assume. Both, the mod.dat and pred.dat are very laarge datasets (>10,000 rows for 180 predictors). I transform and modify both dataframes with the same script, so theoretically they should be the same. I have factors, that I dummy out in both data sets. Pred.dat has 10x as many rows. I hoped somebody could guide me where I could start looking for the problem within the data from what the error says .... – KG12 May 29 '16 at 09:36

0 Answers0