Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90

Tags:

r

glmnet

it just reports:

Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90.

i don't know why.

    x.m <- data.matrix(train[,c(1:43)])
    x.m [is.na(x.m)] <- 0
    y.m <- train$NPL
    cv.m <-data.matrix(cv)
    set.seed(356)


    cvfit.m.lasso = cv.glmnet(x.m, y.m, 
                      family = "binomial", 
                      alpha = 1,
                      type.measure = "class")
    par(mfrow=c(1,2))
    plot(cvfit.m.lasso, main = "Lasso")
    coef(cvfit.m.lasso, s = "lambda.min")
    predTrain.M = predict(cvfit.m.lasso, newx=cv.m, type="class")
    table(cv$NPL, predTrain.M)
like image 314
ROSA LILI Avatar asked Apr 11 '18 11:04

ROSA LILI


1 Answers

It is fixed for me now. It was because I forgot to remove my Target variable from the test data , and that is why i was getting this error.

like image 108
Divya Avatar answered Nov 07 '22 03:11

Divya