• Register
0 votes
1.3k 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 5 3
6,930 points

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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 413 views
413 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
2 answers 115 views
115 views
Problem : I am stuck because of following weired error error in sort.list(y) : 'x' must be atomic for 'sort.list' have you called 'sort' on a list?
asked Nov 15, 2019 peterlaw 6.9k points
1 vote
1 answer 988 views
988 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 806 views
806 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 917 views
917 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