Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/usr/bin/Rscript
  2. library(Matrix)
  3. library(glmnet)
  4.  
  5. args = commandArgs(trailingOnly=TRUE)
  6.  
  7. if (!length(args)==3) {
  8. stop("Three arguments must be supplied ( file name where model is stored (RDataname), test file (.txt, matrix) and file name for AUC output).n", call.=FALSE)
  9. }
  10.  
  11. #read test data set and model
  12. load(args[1])
  13. testMM = readMM(args[2])
  14. testMM_reg <- as.matrix(testMM)
  15.  
  16. #predict test data
  17. preds = predict(glmnet_classifier, testMM_reg[,2:500] , type = 'response')[, 1]
  18. glmnet:::auc(testMM_reg[,1], preds)
  19.  
  20. #write AUC into txt file
  21. write.table(file=args[3],paste('AUC for the test file is : ',glmnet:::auc(testMM_reg[,1], preds)),row.names = FALSE,col.names = FALSE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement