countmin

package
v0.0.0-...-cbd5ca3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package countmin is an implementation of the CountMin Sketch (https://sites.google.com/site/countminsketch/cm-latin.pdf?attredirects=0)

Index

Constants

View Source
const DELTA float64 = 0.99

DELTA is a default value for delta (confidence)

View Source
const EPSILON float64 = 0.001

EPSILON is a default value for epsilon (error rate)

Variables

This section is empty.

Functions

This section is empty.

Types

type CountMinSketch

type CountMinSketch struct {
	// contains filtered or unexported fields
}

CountMinSketch is the CountMin sketch data structure

func NewCountMinSketch

func NewCountMinSketch(epsilon, delta, decayRatio float64) *CountMinSketch

NewCountMinSketch is the constructor function. The CountMin Sketch relative accuracy is within a factor of epsilon with probability delta.

func (*CountMinSketch) Add

func (CountMinSketch *CountMinSketch) Add(element uint64, increment float64) float64

Add is a method to add an element to the sketch

func (*CountMinSketch) Dump

func (CountMinSketch *CountMinSketch) Dump() <-chan float64

Dump is a method that returns each counter value in the sketch

func (*CountMinSketch) GetDecayWeight

func (CountMinSketch *CountMinSketch) GetDecayWeight() float64

GetDecayWeight is a method to return the decay weight set in the data structure

func (*CountMinSketch) GetDepth

func (CountMinSketch *CountMinSketch) GetDepth() uint32

GetDepth is a method to return the number of hash tables (d) in the sketch

func (*CountMinSketch) GetEstimate

func (CountMinSketch *CountMinSketch) GetEstimate(element uint64) float64

GetEstimate is a method to get the estimated frequency of a query element

func (*CountMinSketch) GetWidth

func (CountMinSketch *CountMinSketch) GetWidth() uint32

GetWidth is a method to return the number of counters (g) used in each table of the sketch

func (*CountMinSketch) Wipe

func (CountMinSketch *CountMinSketch) Wipe()

Wipe is a method to clear all the counters in the sketch

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL