Class: BigBench::PostProcessor::Environment::Statistics
- Inherits:
-
Object
- Object
- BigBench::PostProcessor::Environment::Statistics
- 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
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(x, y, degree) ⇒ Statistics
constructor
A new instance of Statistics.
-
#max ⇒ Object
The maximum of the attribute.
-
#mean ⇒ Object
(also: #average)
The mean or average of the attribute.
-
#min ⇒ Object
The minimum of the attribute.
-
#squared_deviation ⇒ Object
(also: #variance)
The squared deviation or variance of the attribute.
-
#standard_deviation ⇒ Object
(also: #sd)
The standard deviation or sd of the attribute.
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
#x ⇒ Object (readonly)
Returns the value of attribute x.
241 242 243 |
# File 'lib/bigbench/post_processor/environment.rb', line 241 def x @x end |
#y ⇒ Object (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
#max ⇒ Object
The maximum of the attribute
249 250 251 |
# File 'lib/bigbench/post_processor/environment.rb', line 249 def max @y.max end |
#mean ⇒ Object 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 |
#min ⇒ Object
The minimum of the attribute
254 255 256 |
# File 'lib/bigbench/post_processor/environment.rb', line 254 def min @y.min end |
#squared_deviation ⇒ Object 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_deviation ⇒ Object 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 |