• Register
0 votes

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

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.

36.1k points

Related questions

0 votes
1 answer 256 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 79 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 990 views
Problem : I want to perform a logistic regression but I am facing following error I am unable to find my mistake. summary(glm(prefmerkel~angst+crisismerkel+leadership+trustworthiness+ideology+pid+agegroups+gender+region,data=gles)) Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, ... In Ops.factor(eta, offset) : -' nicht sinnvoll für Faktoren 3: In Ops.factor(y, mu) : -' nicht sinnvoll für Faktoren
asked Nov 24, 2019 alecxe 7.5k points
1 vote
1 answer 785 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 661 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