Hi:
Here's what I got when I ran your code:
library('glmnet')
> x=matrix(rnorm(100*20),100,20)
> y=rnorm(100)
> cv.fit=cv.glmnet(x,y)
> predict(cv.fit,newx=x[1:5,])
1
[1,] 0.1213114
[2,] 0.1213114
[3,] 0.1213114
[4,] 0.1213114
[5,] 0.1213114
> coef(cv.fit)
21 x 1 sparse Matrix of cla
Hi there,
I am trying to use predict() with an object returned by cv.glmnet(), and get
the following error:
no applicable method for 'predict' applied to an object of class "cv.glmnet"
What's wrong?
my code:
x=matrix(rnorm(100*20),100,20)
y=rnorm(100)
cv.fit=cv.glmnet(x,y)
predict(cv.fit,newx=
2 matches
Mail list logo