cmts

package module
v0.0.0-...-4a1805f Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: MIT Imports: 4 Imported by: 0

README

Count-Min Tree Sketch GoDoc

Count-Min Tree Sketch: Approximate counting for NLP - Guillaume Pitel, Geoffroy Fouquier, Emmanuel Marchand, Abdul Mouhamadsultane,

Abstract

The Count-Min Sketch is a widely adopted structure for approximate event counting in large scale processing. In previous works, the original version of the Count-Min-Sketch (CMS) with conservative update has been improved using approximate counters instead of linear counters. These structures are computationaly efficient and improve the average relative error (ARE) of a CMS at constant memory footprint. These improvements are well suited for NLP tasks, in which one is interested by the low-frequency items. However, if Log counters allow to improve ARE, they produce a residual error due to the approximation. In this paper, we propose the Count-Min Tree Sketch variant with pyramidal counters,which are focused toward taking advantage of the Zipfian distribution of text data.

Usage

import "github.com/seiflotfy/cmts"

...

// Number of bits ot use as a base
cmts := New(8388608)

// Incremeent "foobar" by 1
cmts.Increment([]byte("foobar"))

// Get freqeuency of "foobar"
count := cmts.Get([]byte("foobar"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sketch

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

Sketch is Count-Min-Tree Sketch

func New

func New(baseSize uint) *Sketch

New returns a Count-Min-Tree Sketch for a given baseSize in bits the baseSize results in a sketch of the size 2*((2*baseSize)-1) due to the barrier bits

func (*Sketch) Get

func (sketch *Sketch) Get(val []byte) uint64

Get returns the frequency of val in the sketch

func (*Sketch) Increment

func (sketch *Sketch) Increment(val []byte)

Increment the counter for val in the sketch

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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