class ANTLR3::Profile::DataSet

Public Instance Methods

average() click to toggle source
# File lib/antlr3/profile.rb, line 81
def average
  length > 0 ? ( total.to_f / length ) : 0
end
standard_deviation() click to toggle source
# File lib/antlr3/profile.rb, line 89
def standard_deviation
  sqrt( variance )
end
total() click to toggle source
# File lib/antlr3/profile.rb, line 78
def total
  inject( :+ )
end
variance() click to toggle source
# File lib/antlr3/profile.rb, line 84
def variance
  length.zero? and return( 0.0 )
  mean = average
  inject( 0.0 ) { |t, i| t + ( i - mean )**2 } / ( length - 1 )
end