Skip to main content

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

Metadata

Release files for lossycount 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lossycount 2.0
File Size Uploaded Provenance Actions
lossycount-2.0.tar.gz 31.2 kB Without provenance Details for lossycount-2.0.tar.gz

Release files / lossycount-2.0.tar.gz

Download URL lossycount-2.0.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
87632dc5ce27e2cb636883e0b41803e0f8f45f1a6ba5b08e5a0d7bbc664465ee
BLAKE2b-256 checksum
How to use checksums
e39a1ab8640fa6a799c76a5adbd6228610a8b69627faf1a5cfa43e06ef522bdc
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for lossycount 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page