Class: Spark::Command::Histogram
- Inherits:
-
Object
- Object
- Spark::Command::Histogram
- Includes:
- Helper::Statistic
- Defined in:
- lib/spark/command/statistic.rb
Overview
Histogram
Instance Method Summary collapse
Methods included from Helper::Statistic
#bisect_right, #compute_fraction, #determine_bounds, #upper_binomial_bound, #upper_poisson_bound
Instance Method Details
#lazy_run(iterator) ⇒ Object
75 76 77 |
# File 'lib/spark/command/statistic.rb', line 75 def lazy_run(iterator, *) run(iterator) end |
#run(iterator) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/spark/command/statistic.rb', line 58 def run(iterator, *) counters = Array.new(counter_size) { 0 } iterator.each do |item| if item.nil? || (item.is_a?(Float) && !item.finite?) || item > max || item < min next end x = bucket_function.call(item) if x.nil? # next else counters[x] += 1 end end [counters] end |