Sha256: c911f0bfa5f1ff62d13cd4b53a844bb07931e47c0dd1e262c1d9569a5d660066

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module DDSketch
  # Implementation of BaseSketch with optimized memory usage at the cost of
  # lower ingestion speed, using a limited number of bins. When the maximum
  # number of bins is reached, bins with highest indices are collapsed, which
  # causes the relative accuracy to be lost on the highest quantiles. For the
  # default bin limit, collapsing is unlikely to occur unless the data is
  # distributed with tails heavier than any subexponential.
  class LogCollapsingHighestDenseSketch < BaseSketch
    # @param relative_accuracy (see Sketch#initialize)
    # @param [Integer] bin_limit the maximum number of bins
    def initialize(relative_accuracy: DEFAULT_REL_ACC, bin_limit: DEFAULT_BIN_LIMIT)
      super(
        mapping: Mapping::LogarithmicKeyMapping.new(relative_accuracy: relative_accuracy),
        store: Store::CollapsingHighestDenseStore.new(bin_limit: bin_limit),
        negative_store: Store::CollapsingHighestDenseStore.new(bin_limit: bin_limit)
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddsketch-0.1.0 lib/ddsketch/log_collapsing_highest_dense_sketch.rb