search for: myglmnet

Displaying 1 result from an estimated 1 matches for "myglmnet".

Did you mean: glmnet
2012 Mar 21
2
glmnet: obtain predictions using predict and also by extracting coefficients
...by using means and sd from training data trainMeans <- apply(data.train,2,mean) trainSDs <- apply(data.train,2,sd) # create standardized test data data.test.std <- sweep(data.test, 2, trainMeans) data.test.std <- sweep(data.test.std, 2, trainSDs, "/") # fit training model myglmnet =cv.glmnet(data.train,y) # predictions by using predict function yhat_enet <- predict(myglmnet,newx=data.test, s="lambda.min") # attempting to get predictions by using coefficients beta <- as.vector( t(coef(myglmnet,s="lambda.min"))) testX <- cbind(1,data.test.std...