diff options
Diffstat (limited to 'scripts/confusion-matrix.rb')
-rwxr-xr-x | scripts/confusion-matrix.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/confusion-matrix.rb b/scripts/confusion-matrix.rb new file mode 100755 index 0000000..c40ee2f --- /dev/null +++ b/scripts/confusion-matrix.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +require 'csv' + +tp = 0 +fp = 0 +tn = 0 +fn = 0 +File.readlines(ARGV[0]).each do |line| + pred = line.chomp.split(",").last + case pred + when "TP" + tp+=1 + when "TN" + tn+=1 + when "FP" + fp+=1 + when "FN" + fn+=1 + end +end +puts "#{tp},#{fp}\n#{fn},#{tn}" |