f0

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 2 Imported by: 0

README

f0

An implementation of the CVM algorithm for the distinct elements (f0) problem.

This package implements the CVM algoritm in pure Go. CVM is an algorithm for the distinct elements problem. When you're trying to find the unique elements in a slice, but the slice exceeds the amount of available memory, use f0 to estimate the number of unique elements in said slice.

f0.Estimate(mySlice, 0.01, 0.001) // 329.4221234
More Reading

Contributing

I NEED tests. The problem with this algorithm is that I need large sets of comparable elements to test f0 on. Currently (below v1), there is no guarentee the algorithm will work correctly. After we've developed a large and robust test suite and can establish the algorithm is behaving as expected, this library will be promoted to v1 and maintained.

The Bible is included for testing purposes. There's no copyright in the Kingdom of Heaven.

Documentation

Overview

f0 is an implementation of the CVM algorithm for the distinct elements problem.

The CVM algorithm is best suited for large datasets where sorting unique values would require more than available memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Estimate

func Estimate[T comparable](source []T, e, d float64) float64

Estimate uses the CVM algorithm to calculate the number of unique item in an array. e (epsilon) represents acceptable relative error d (delta) represents the probability of failure for the algorithm to produce an estimation within the specific e-bound.

Types

This section is empty.

Jump to

Keyboard shortcuts

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