Last active
July 21, 2017 21:03
-
-
Save Zoldin/bfc2d4ee449098a9ff64b99c3326e61d to your computer and use it in GitHub Desktop.
evaluate.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/Rscript | |
library(Matrix) | |
library(glmnet) | |
args = commandArgs(trailingOnly=TRUE) | |
if (!length(args)==3) { | |
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) | |
} | |
#read test data set and model | |
load(args[1]) | |
testMM = readMM(args[2]) | |
testMM_reg <- as.matrix(testMM) | |
#predict test data | |
preds = predict(glmnet_classifier, testMM_reg[,2:500] , type = 'response')[, 1] | |
glmnet:::auc(testMM_reg[,1], preds) | |
#write AUC into txt file | |
write.table(file=args[3],paste('AUC for the test file is : ',glmnet:::auc(testMM_reg[,1], preds)),row.names = FALSE,col.names = FALSE) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment