Created
September 8, 2015 20:13
-
-
Save qix/74c07f05c019533c6c7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
import cPickle | |
import zlib | |
from hyperloglog import SlidingHyperLogLog | |
def shlld_from_string(string, error_rate, window_count): | |
lpfm = cPickle.loads(zlib.decompress(string)) if string else None | |
return SlidingHyperLogLog( | |
error_rate=error_rate, | |
window=window_count, | |
lpfm=lpfm, | |
) | |
def shlld_to_string(hyperlog): | |
return zlib.compress(cPickle.dumps(hyperlog.LPFM)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment