0

I try to Cross validate my data to get a good lambda parameter. The cross validation give me an error output because of different weights. I didn´t set up any wheigts so far.

i thought its a problem of the number of rows in y.train and X.mat.train but i looked at them and they have both an equal number nrow = 80.000.

set.seed(1234)
str(X.mat.train)
# num [1:80000, 1:36]    
str(y.train)
# num [1:80000] 

lambda.seq<- c(2^seq(3,-16,length=99),0)

cv.en <- cv.glmnet(X.mat.train, y.train, intercept=FALSE, standardize=TRUE,  alpha=0,5, nfold=10, lambda = lambda.seq)

My Output in the end is:

Error in glmnet(x, y, weights = weights, offset = offset, lambda = lambda, : number of elements in weights (1) not equal to the number of rows of x (80000)

Any Idea?

demarsylvain
  • 2,103
  • 2
  • 14
  • 33

0 Answers0