#Suppose I have a file name pred200 in the path "/Users/Sha/" and inside this file there are two columns, one is 'prediction' the other is 'label'.
data <- read.table("/Users/Sha/pred200",sep=" ",header=TRUE)#Read data from file, inside the file each row is separated by a 'space' and there is a header in the file. A header is the name of the column.
pred <- prediction(data$predictions, data$labels)
# transform the metric to variable pred
perf <- performance(pred, "tpr", "fpr")
perf.auc <- performance(pred, "auc")
perf.auc.areas <- slot(perf.auc, "y.values")
Labels: R, StudyNote
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home