• 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 5 3
6,930 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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 700 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 143 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 1.3K 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 1.1K 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 1.3K 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
1 vote
1 answer 1.8K 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
0 votes
2 answers 2.3K views
Problem : Below is my code which is giving me the error. plot(x,y) yx.lm <- lm(y ~ x) lines(x, predict(yx.lm), col="red") Why am I facing following error? Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 2.8K views
Problem : While I am trying to run the boxcox transformation with the following code urban1 <- subset(ski,urban <= 4,na.rm=TRUE) ski$gender <- as.numeric((as.character(ski$gender)),na.rm=TRUE) urban1 <- as.numeric((as.character(urban1))) a <- (ski$gender*urban1) ... -> boxcar -> boxcar.formula -> lm -> lm.fit Execution halted Please let me know if anyone knows the solution for this error message.
asked Nov 27, 2019 alecxe 7.5k points
0 votes
1 answer 1.2K views
Problem : Suppose I have data.frame a And I am using following code m.fit <- lm(col2 ~ col3 * col4, na.action = na.exclude) Here the col2 has some NA values And col3,col4 have values less than 1. I am getting following error: Error in lm.fit ... because of the NAs. Problem with this warning is interpreted by every google results is pointing towards the NA values. Have I misinterpreted the error ?
asked Nov 22, 2019 peterlaw 6.9k points
0 votes
2 answers 1.3K views
Problem : I am facing below error and I am unable to understand the meaning of the error. All my variable names are correct and there are no typing errors. Does anybody faced this issue before any solution on it? My erroneous code : datNewagg <- aggregate (dataNew, by = ... mean) It gives following error : Error in aggregate.data.frame(datNew, by = list("x", "y", : arguments must have same length
asked Dec 6, 2019 alecxe 7.5k points