Skip to main content

No project description provided

Project description

Finding Frequent Items 频繁集挖掘

Install

apt-get install -y libboost-python-dev
pip install lossycount

if cannot find -lboost_python3

occurred.

Then I went to

/usr/lib/x86_64-linux-gnu

search and found that the library file is in different name as

libboost_python-py35.so

so I made a link by following command

sudo ln -s libboost_python-py35.so libboost_python3.so which solved my problem.

Use

from lossycount import LossyCount

# 0.001 是要统计的频率下限
lc = LossyCount(0.001)

for i in range(200):
  for j in range(100):
    for k in range(j):
      lc.incr(j)
      # lc.incr(j, 1)

for i in range(1, 100, 30):
  print(i)
  print("出现的次数(估计值)", lc.est(i))
  print(
    "estimate the worst case error in the estimate of a) particular item :",
    lc.err(i)
  )
  print("---" * 20)

result = lc.output(1000)
result.sort(key=lambda x: -x[1])
print(result)

print(lc.capacity())

Thanks

hadjieleftheriou.com/frequent-items

version 1.0

Description

This package provides implementations of various one pass algorithms for finding frequent items in data streams. In particular it contains the following:

  • Frequent Algorithm
  • Lossy Counting, and variations
  • Space Saving
  • Greewald & Khanna
  • Quantile Digest
  • Count Sketch
  • Hierarchical Count-Min Sketch
  • Combinatorial Group Testing

The code is an extension of the MassDAL library. Implementations are by Graham Cormode.

Citations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lossycount-2.0.tar.gz (31.2 kB view details)

Uploaded Source

File details

Details for the file lossycount-2.0.tar.gz.

File metadata

  • Download URL: lossycount-2.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for lossycount-2.0.tar.gz
Algorithm Hash digest
SHA256 87632dc5ce27e2cb636883e0b41803e0f8f45f1a6ba5b08e5a0d7bbc664465ee
MD5 1cdde3de1fd8e33c6fe2ec7cd36e3f2b
BLAKE2b-256 e39a1ab8640fa6a799c76a5adbd6228610a8b69627faf1a5cfa43e06ef522bdc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page