public class CountMinSketch extends Object implements IFrequency
Modifier and Type | Class and Description |
---|---|
protected static class |
CountMinSketch.CMSMergeException |
Modifier and Type | Field and Description |
---|---|
static long |
PRIME_MODULUS |
Constructor and Description |
---|
CountMinSketch(double epsOfTotalCount,
double confidence,
int seed) |
CountMinSketch(int depth,
int width,
int seed) |
Modifier and Type | Method and Description |
---|---|
void |
add(long item,
long count) |
void |
add(String item,
long count) |
static CountMinSketch |
deserialize(byte[] data) |
long |
estimateCount(long item)
The estimate is correct within 'epsilon' * (total item count),
with probability 'confidence'.
|
long |
estimateCount(String item) |
double |
getConfidence() |
double |
getRelativeError() |
static CountMinSketch |
merge(CountMinSketch... estimators)
Merges count min sketches to produce a count min sketch for their combined streams
|
static byte[] |
serialize(CountMinSketch sketch) |
long |
size() |
public static final long PRIME_MODULUS
public CountMinSketch(int depth, int width, int seed)
public CountMinSketch(double epsOfTotalCount, double confidence, int seed)
public double getRelativeError()
public double getConfidence()
public void add(long item, long count)
add
in interface IFrequency
public void add(String item, long count)
add
in interface IFrequency
public long size()
size
in interface IFrequency
public long estimateCount(long item)
estimateCount
in interface IFrequency
public long estimateCount(String item)
estimateCount
in interface IFrequency
public static CountMinSketch merge(CountMinSketch... estimators) throws CountMinSketch.CMSMergeException
estimators
- CountMinSketch.CMSMergeException
- if estimators are not mergeable (same depth, width and seed)public static byte[] serialize(CountMinSketch sketch)
public static CountMinSketch deserialize(byte[] data)
Copyright © 2019. All rights reserved.