• Register
0 votes
2.8k views

Problem :

I am trying to predict probabilities in a dataset by using glmnet but facing following issue
cholmod error 'x and/or y have wrong dimensions' at file ../matrixops/cholmod_sdmult.c, line 90
6.9k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

It seems you just have wrongly thing assigned to newx. Instead of:

bank$rich <- NULL newx = data.matrix(test$rich)

I guess you need to null out the values in test$rich and then need to feed test to data.matrix. So something like below: 

test$rich <- NULL newx = data.matrix(test) ridge.pred=predict(ridge.mod,newx=newx) 

It worked for me.

Also i think your original data frame has some patterns based on the row: so rows after 200 have NA values in newAccount. So you may want to address missing values and your train/test split before your regression.

38.6k points

Related questions

0 votes
1 answer 100 views
100 views
Problem: Hey everyone, any Help: cholmod error 'x and/or y have wrong dimensions' at file ../matrixops/cholmod_sdmult.c, line 90
asked Mar 13 Wafa Abu Yousef 6.1k points
0 votes
1 answer 64 views
64 views
Problem: I get the following error when using ridge and lasso regression. Error in storage.mode(y) <- "double" : invalid to change the storage mode of a factor My data set looks like this: > as_data_frame(blca.only) # A tibble: 315 x 435 Tags TCGA.BL.A5ZZ.01 TCGA.XF.AAN1.01 TCGA.DK.A2I4. ... .01 <dbl>, TCGA.GD.A3OP.11 <dbl>, TCGA.K4.A4AC.01 <dbl>, # TCGA.GD.A2C5.01 <dbl>, TCGA.4Z.AA84.01 <dbl>,
asked Apr 25 Humaira ahmed 50.7k points
0 votes
1 answer 1.2k views
1.2k views
Problem : I want to use the neural net for predictions. I am trying to create some X as follows : x <- cbind(seq(1, 50, 1), seq(51, 100, 1)) I am trying to create some Y as follows : y <- x[,1]*x[,2] Give them the names as follows colnames(x) ... =0.01) error in terms.formula(formula) : '.' in formula and no 'data' argument Does anybody have any idea regarding the error I am facing? Any solution?
asked Dec 11, 2019 alecxe 7.5k points
0 votes
1 answer 10 views
10 views
Problem: Error: protect(): protection stack overflow.
asked Jul 11 Rada Gracelynn 104k points
0 votes
1 answer 11 views
11 views
Problem: Error in model.frame.default object is not a matrix
asked Jun 28 nila 121k points
0 votes
1 answer 58 views
58 views
Problem: I need help in solving this error: Error in cbind2(1, newx) %*% nbeta : invalid class 'na' to dup_mmatrix_as_dgematrix
asked Mar 14 Wafa Abu Yousef 6.1k points
1 vote
1 answer 1.9k views
1.9k views
Problem : I want to use the glmnet package on a dataset. I am trying to use cv.glmnet() to get the lambda value for the glmnet(). Please find below the dataset and error message: > head(t2) X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 1 ... in evaluating the argument 'x' in selecting a method for function 't': Error: invalid class 'NA' to dup_mMatrix_as_dgeMatrix Any suggestions regarding the solution?
asked Dec 14, 2019 alecxe 7.5k points
0 votes
1 answer 2.1k views
2.1k views
Problem : When ever i use the predict glmnet function i get the below mentioned error error in cbind2(1, newx) %*% nbeta : not-yet-implemented method for <data.frame> %*% <dgcmatrix>
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 1.7k views
1.7k views
Problem : I am learning to work with neural networks in R. As a learning tutorial I am using the following problem over at Kaggle: https://www.kaggle.com/c/titanic This problem is specifically designed for people who want to learn and please note there is no reward ... Error in neurons[[i]] %*% weights[[i]] : requires numeric/complex matrix/vector arguments Can anyone help in resolving my issue?
asked Nov 27, 2019 alecxe 7.5k points
0 votes
1 answer 6 views
6 views
Problem: Invalid prediction for "rpart" object?
asked 6 days ago Mezbah 130k points