Class: BigBench::PostProcessor::Environment::Statistics

Inherits:
Object
  • Object
show all
Includes:
BigBench::PostProcessor::Environment
Defined in:
lib/bigbench/post_processor/environment.rb

Overview

Calculates the default statistic values for a given attribute, like the duration, requests, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BigBench::PostProcessor::Environment

#appearing, #cluster, #each_benchmark, #each_tracking, #normal_distribution, #polynomial_regression, reset!, #scope, #scope_to_benchmark, #statistics, #trackings

Constructor Details

#initialize(x, y, degree) ⇒ Statistics

Returns a new instance of Statistics.



244
245
246
# File 'lib/bigbench/post_processor/environment.rb', line 244

def initialize x, y, degree
  @x, @y = x, y
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



241
242
243
# File 'lib/bigbench/post_processor/environment.rb', line 241

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



242
243
244
# File 'lib/bigbench/post_processor/environment.rb', line 242

def y
  @y
end

Instance Method Details

#maxObject

The maximum of the attribute



249
250
251
# File 'lib/bigbench/post_processor/environment.rb', line 249

def max
  @y.max
end

#meanObject Also known as: average

The mean or average of the attribute



259
260
261
# File 'lib/bigbench/post_processor/environment.rb', line 259

def mean
  @y.average
end

#minObject

The minimum of the attribute



254
255
256
# File 'lib/bigbench/post_processor/environment.rb', line 254

def min
  @y.min
end

#squared_deviationObject Also known as: variance

The squared deviation or variance of the attribute



272
273
274
275
# File 'lib/bigbench/post_processor/environment.rb', line 272

def squared_deviation
  u = mean
  @y.inject(0){ |result, element| result + (element - u) ** 2 }.to_f / @y.size.to_f
end

#standard_deviationObject Also known as: sd

The standard deviation or sd of the attribute



265
266
267
268
# File 'lib/bigbench/post_processor/environment.rb', line 265

def standard_deviation
  u = mean
  @y.inject(0){ |result, element| result + (element - u).abs }.to_f / @y.size.to_f
end