Sha256: 4b9a3dadda116bae1eff5b60b7ff041b4aaf762ab56bf77958b5f91fe23b38a0

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

module Quarry
  class ConfusionMatrix
    attr_reader :confusion_matrix
    attr_reader :data_set
    def initialize(data_set, matrix=nil)
      @data_set = data_set
      if matrix
        @confusion_matrix = matrix
      else
        @confusion_matrix = Quarry::ImplConfusionMatrix.new(data_set.data_set)
      end
    end
    
    def add(predicted, actual)
      @confusion_matrix.add(predicted.category, actual.category)
    end
    
    def accuracy
      @confusion_matrix.accuracy
    end
    
    def error
      @confusion_matrix.error
    end
    
    def tp(category)
      @confusion_matrix.tp(category.category)
    end
    
    def fp(category)
      @confusion_matrix.fp(category.category)
    end
    
    def tn(category)
      @confusion_matrix.tn(category.category)
    end
    
    def fn(category)
      @confusion_matrix.fn(category.category)
    end
    
    def precision(category)
      @confusion_matrix.precision(category)
    end
    
    def recall(category)
      @confusion_matrix.recall(category)
    end
    
    def fscore(category)
      @confusion_matrix.fscore(category)
    end
    
    def print_summary
      @confusion_matrix.print_summary
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thera-0.0.8 lib/quarry_rb/confusion_matrix.rb
thera-0.0.7 lib/quarry_rb/confusion_matrix.rb
thera-0.0.6 lib/quarry_rb/confusion_matrix.rb
thera-0.0.5 lib/quarry_rb/confusion_matrix.rb
thera-0.0.4 lib/quarry_rb/confusion_matrix.rb
thera-0.0.3 lib/quarry_rb/confusion_matrix.rb
thera-0.0.2 lib/quarry_rb/confusion_matrix.rb
thera-0.0.1 lib/quarry_rb/confusion_matrix.rb