Class: SAAL::OutlierCache
- Inherits:
-
Object
- Object
- SAAL::OutlierCache
- Defined in:
- lib/outliercache.rb
Constant Summary collapse
- COMP_CACHE_SIZE =
By feeding values into this cache the outliers are identified. The cache is conservative and only flags down values that it is sure are outliers. The cache considers itself “live” when the values in the cache are all within a few percent of each other and will then flag down outliers. When the cache is not live all values will be considered good.
11
- MAX_CACHE_DEVIATION =
These are conservative settings that can be made stricted if the cache is not rejecting enough values or is often not “live” Sets how close the central values have to be for the cache to be “live”
0.05
- MAX_VALUE_DEVIATION =
Sets how off the read value can be from the cache median to be accepted
0.15
Instance Method Summary collapse
-
#initialize ⇒ OutlierCache
constructor
A new instance of OutlierCache.
- #live ⇒ Object
- #validate(value) ⇒ Object
Constructor Details
#initialize ⇒ OutlierCache
Returns a new instance of OutlierCache.
18 19 20 |
# File 'lib/outliercache.rb', line 18 def initialize @compcache = [] end |
Instance Method Details
#live ⇒ Object
22 23 24 |
# File 'lib/outliercache.rb', line 22 def live @compcache.size == COMP_CACHE_SIZE && valid_cache end |
#validate(value) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/outliercache.rb', line 26 def validate(value) ret = compare_with_cache(value) @compcache.shift if @compcache.size == COMP_CACHE_SIZE @compcache.push value ret end |