countminsketch

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package countminsketch implements Count-Min Sketch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountMinSketch

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

CountMinSketch struct.

func New

func New(width, depth uint) (*CountMinSketch, error)

New returns new Count-Min Sketch with the given `width` and `depth`.

func NewGuess

func NewGuess(epsilon, delta float64) (*CountMinSketch, error)

NewGuess returns new Count-Min Sketch with the given error rate `epsilon` and confidence `delta`.

func (*CountMinSketch) Add

func (c *CountMinSketch) Add(data []byte, count ...uint64)

Add add the `data` to the sketch. `count` default to 1.

func (*CountMinSketch) AddString

func (c *CountMinSketch) AddString(data string, count ...uint64)

AddString add the `data` string to the sketch. `count` default to 1.

func (*CountMinSketch) Count

func (c *CountMinSketch) Count() uint64

Count returns the number of items added to the sketch.

func (*CountMinSketch) Depth

func (c *CountMinSketch) Depth() uint

Depth returns the matrix depth.

func (*CountMinSketch) Estimate

func (c *CountMinSketch) Estimate(data []byte) uint64

Estimate estimate the frequency of the `data`.

func (*CountMinSketch) EstimateString

func (c *CountMinSketch) EstimateString(data string) uint64

EstimateString estimate the frequency of the `data` string.

func (*CountMinSketch) Merge

func (c *CountMinSketch) Merge(other *CountMinSketch) error

Merge combines the sketch with another.

func (*CountMinSketch) Reset

func (c *CountMinSketch) Reset()

Reset reset the sketch to its original state.

func (*CountMinSketch) Width

func (c *CountMinSketch) Width() uint

Width returns the matrix width.

Jump to

Keyboard shortcuts

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