search for: trainsds

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

Did you mean: trained
2012 Mar 21
2
glmnet: obtain predictions using predict and also by extracting coefficients
...;- data.train$lpsa # isolate predictors data.train <- as.matrix(data.train[,-c(9,10)]) # test data data.test <- prostate[!prostate$train,] data.test <- as.matrix(data.test[,-c(9,10)]) # scale test data 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 <-...