Sha256: ceaaa8c633655975d8a6796e7d47584276ff1bacefed2ec076d094b1705ab0d8

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 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 lowest indices are collapsed, which
  # causes the relative accuracy to be lost on the lowest quantiles. For the
  # default bin limit, collapsing is unlikely to occur unless the data is
  # distributed with tails heavier than any subexponential.
  class LogCollapsingLowestDenseSketch < 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::CollapsingLowestDenseStore.new(bin_limit: bin_limit),
        negative_store: Store::CollapsingLowestDenseStore.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_lowest_dense_sketch.rb