Sha256: 2f55af76e0370b039048bfbae19790663466d6ea9c93cefd9d2e38f2e6e15d57
Contents?: true
Size: 715 Bytes
Versions: 4
Compression:
Stored size: 715 Bytes
Contents
module Ms module ErrorRate module Decoy # this is the # true positives (found by estimating the number of false # hits using the # decoy) # frit == fraction def self.precision(num_target, num_decoy, frit=1.0) # will calculate as floats in case fractional amounts passed in for # whatever reason num_target_f = num_target.to_f num_true_pos = num_target_f - (num_decoy.to_f * frit) precision = if num_target_f == 0.0 if num_decoy.to_f > 0.0 0.0 else 1.0 end else num_true_pos/num_target_f end precision end end end end
Version data entries
4 entries across 4 versions & 1 rubygems