Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions datasketch/hyperloglog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import struct, copy
from hashlib import sha1
import numpy as np
from warnings import warn
try:
from .hyperloglog_const import _thresholds, _raw_estimate, _bias
except ImportError:
Expand Down Expand Up @@ -31,7 +32,7 @@ class HyperLogLog(object):
reg (numpy.array, optional): The internal state.
This argument is for initializing the HyperLogLog from
an existing one.
hashobj (optional): The hash function used.
hashobj (optional): The hash function used.
It must implements
the `digest()` method similar to hashlib_ hash functions, such
as `hashlib.sha1`.
Expand All @@ -46,7 +47,7 @@ class HyperLogLog(object):

def _get_alpha(self, p):
if not (4 <= p <= 16):
raise ValueError("p=%d should be in range [4 : 16]" % p)
warn("p=%d should be in range [4 : 16]" % p)
if p == 4:
return 0.673
if p == 5:
Expand Down Expand Up @@ -169,7 +170,7 @@ def clear(self):
def __len__(self):
'''
Returns:
int: Get the size of the HyperLogLog as the size of
int: Get the size of the HyperLogLog as the size of
`reg`.
'''
return len(self.reg)
Expand All @@ -179,7 +180,7 @@ def __eq__(self, other):
Check equivalence between two HyperLogLogs

Args:
other (datasketch.HyperLogLog):
other (datasketch.HyperLogLog):

Returns:
bool: True if both have the same internal state.
Expand Down Expand Up @@ -282,7 +283,7 @@ class HyperLogLogPlusPlus(HyperLogLog):
2. A new small-cardinality estimation scheme
3. Sparse representation (not implemented here)

This class has the same set of methods as
This class has the same set of methods as
:class:`datasketch.HyperLogLog`.
'''

Expand Down