vhll

package module
v0.0.0-...-938678a Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2017 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Virtual HyperLogLog

A virtual HyperLogLog is a highly compact virtual maximum likelihood Sketch for counting big network data.

TL;DR: Multiple HyperLogLogs in one HyperLogLog, by sharing bits amongst each other (down to 0.1 bits in theory per register)

Long version: The datastructure takes from the paper (see below) which proposes a new method, called virtual maximum likelihood sketches, to reduce memory consumption by cardinality estimation on a large number of flows. It embodies two ideas. The first idea is called virtual sketches, which uses no more than two bits per sketch on average, while retaining the functional equivalence to an FM sketch. The second idea is called virtual sketch vectors, which combine the sketches of all flows into a mixed common pool. Together, these two ideas can drastically reduce the overall memory overhead. Based on virtual sketches and virtual vectors, we design a cardinality estimation solution with an online operation module and an offline estimation module.

For details about the algorithm and citations please use this paper for now

"Hyper-Compact Virtual Estimators for Big Network Data Based on Register Sharing" by Qingjun Xiao, Shigang Chen, Min Chen & Yibei Ling

##Note This implementation uses a a static bucket size of register size of 1 byte instead of 6 bits. It's still under development, but the main concept is implemented, just needs optimizations.

##Example usage:


import "github.com/seiflotfy/vhll"

v, _ := vhll.NewForLog2m(24)

//repeat several times for higher accuracy since this is a maximum likelihood sketch
v.Add([]byte("first flow"), []byte("some data")) 

count := cf.GetCardinality([]byte("first flow"))
// count == <number of repeats> +/- 13% for now

count := cf.GetTotalCardinality()
// count == <number of repeats> +/- 13% for now

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VHLL

type VHLL struct {
	M []uint8
	// contains filtered or unexported fields
}

VHLL ...

func NewVHLL

func NewVHLL(precision, vPrecision uint8) (*VHLL, error)

NewVHLL ...

func (*VHLL) Estimate

func (v *VHLL) Estimate(f []byte) uint64

Estimate ...

func (*VHLL) Insert

func (v *VHLL) Insert(f []byte, e []byte)

Insert ...

Jump to

Keyboard shortcuts

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