Determining Classification Error: FAR Vs 1-FRR
Determining Classification Error: FAR Vs 1-FRR
Problem: Given samples s1, s2, , s10, we try to detect outliers. How good is our
algorithm?
Given specific values for d and p, our program classifies some samples as outliers, and
some as not outliers. (In other words, the number of output classes is 2; so the
contingency table will have dimension 2x2).
The true outliers are s8 and s9.
Find the error.
The contingency table will look like this:
True results
outliers
Our
programs
results
not outliers
outliers
not outliers
10
Number of false positives = FP (is the number in first row, column 2)
Number of false negatives = FN (the number in second row, column 1)
Total number = TN = 10, always (because we have 10 samples).
FAR = FP/TN
FRR = FN/TN
Every time you run your program for a certain value of p and a certain value of d, there
will be a new contingency table.
For example, lets assume we ran the program for d=4 and p =3, and our programs
output is that the outliers are s2, s3, and s8. So, our program detected s2 and s3 as outliers
but they are not outliers; therefore, s2 and s3 are false positives. Our program did not
detect s9 as outlier although it is an outlier, so s9 is a false negative. For this run, the
contingency table is:
Our
programs
results
outliers
True results
outliers
1 (i.e. s8)
Not outliers
1 (i.e. s9)
2
FP = 2
FN = 1
Not outliers
2 (i.e. s2 and 3
s3)
6 (i.e. s1, s4,
7
s5, s6, s7, and
s10)
8
10
TN = 10
FAR = 2/10
FRR = 1/10
Output FAR vs 1-FRR into a file, so that it can be plotted later.
Pseudocode:
//Assume that your program stores its results (i.e. the detected outliers) into an array
output[].
//Assume that the true outliers are in array trueouts[], where trueouts[1]=s8 and
trueouts[2] = s9.
//Assume TN = 10
ErrorPlot() {
Open file toBploted for appended writing
For (several (p,d) values) {
FP=0
For i=1, sizeof(output[])
If output[i]!=s8 or s9,
FP++
}
}
FN=0
For (i=1, sizeof(trueouts[]) {
If trueouts[i] is not found in output[] {
FN++
}
}
FAR = FP/TN
FRR = FN/TN
Print FAR, 1-FRR into toBploted
}
}