Documentation ¶
Overview ¶
Package countminsketch implements Count-Min Sketch.
Index ¶
- type CountMinSketch
- func (c *CountMinSketch) Add(data []byte, count ...uint64)
- func (c *CountMinSketch) AddString(data string, count ...uint64)
- func (c *CountMinSketch) Count() uint64
- func (c *CountMinSketch) Depth() uint
- func (c *CountMinSketch) Estimate(data []byte) uint64
- func (c *CountMinSketch) EstimateString(data string) uint64
- func (c *CountMinSketch) Merge(other *CountMinSketch) error
- func (c *CountMinSketch) Reset()
- func (c *CountMinSketch) Width() uint
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.