Class: ROC
- Inherits:
-
Object
- Object
- ROC
- Defined in:
- lib/rroc.rb
Overview
This class provides methods for Reciever Operating Characteristic (ROC) curve calculation; algorithm copied from the ML-Mathematica mathematica library by Steven Bedrick ([email protected]). For an excellent overview of ROC analysis, check out:
Fawcett, T. “An introduction to ROC analysis” Pattern Recognition Letters 27 (2006) 861-874 (pdf)
first col of mat is discrim. val; second col is label (+1 -> pos, -1 -> neg, higher disc. val -> more pos)
e.g.: [[.3, -1], [.7, 1], [.1, -1] . . . ]
The scale of first column is not important. The labels in the second column are.
pts plot fpr (x-axis) against tpr (y-axis)
Class Method Summary collapse
-
.auc(dat) ⇒ Fixnum
Calculates the “area under the ROC curve” for the output of a binary classifier.
-
.curve_points(dat) ⇒ Array
Returns a set of x/y coordinates describing an ROC curve for
dat
plotting the FPR on the abscissa and the TPR on the ordinate.
Class Method Details
.auc(dat) ⇒ Fixnum
Calculates the “area under the ROC curve” for the output of a binary classifier.
19 20 21 |
# File 'lib/rroc.rb', line 19 def self.auc(dat) return self.calc(dat, false) end |
.curve_points(dat) ⇒ Array
Returns a set of x/y coordinates describing an ROC curve for dat
plotting the FPR on the abscissa and the TPR on the ordinate.
26 27 28 |
# File 'lib/rroc.rb', line 26 def self.curve_points(dat) return self.calc(dat, true)[:points] end |