I'm trying to use sparse linear model for my data,input x(29*50),output y(29*1). In R, the package of glmnet can be used.
Firstly, cv.glmnet() choose lambda and coefficients(at min error), here with leave-one-out cv method,and then plot it.
cv.fit = cv.glmnet(x,y,family="gaussian",nfolds=29) plot(cv.fit)
Next, print the coefficients
51 x 1 sparse Matrix of class "dgCMatrix"
Finally, to measure the model's ability for prediction, accuracy is calculated(defined as 1 minus average absolute error divided by numeric range of y)
py <- predict(cv.fit,newx=x,s="lambda.min") py
ave_abs_error <- mean(abs(py-y)) n_range <- max(y)-min(y) acc <- 1-ave_abs_error/n_range acc
Although the acc(0.918365) is very high, there is a serious problem. As seen from the plot above, the lambda.min is very large(73.03439),and all coefficients are zero(only with intercept value 267.7241), all predicted py are the same as intercept. That's really weird!
I searched lots of threads in forum, hereAn example: LASSO regression using glmnet for binary outcome explains that there is no local min for too few observations and all coefficients were shrunk to zero with the shrinkage penalties.
Does anybody has other interpretations?
Thanks in advance!