1234567891011121314 |
- require 'confusion_matrix'
- cm = ConfusionMatrix.new :pos, :neg # the matrix has two classes
- cm.add_for(:pos, :pos, 10) # add 10 observations of (:pos, :pos)
- 3.times { cm.add_for(:pos, :neg) } # add 3 observations separately
- 20.times { cm.add_for(:neg, :neg) }
- 5.times { cm.add_for(:neg, :pos) }
- puts "Precision: #{cm.precision}" # results for :pos class
- puts "Recall: #{cm.recall}"
- puts "MCC: #{cm.matthews_correlation}"
- puts
- puts(cm.to_s)
|