npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cvm-js

v1.0.1

Published

An implementation in TypeScript of the novel probabilistic CVM counting algorithm

Downloads

6

Readme

CVM Counting Algorithm

Description

  • This project implements the novel CVM counting algorithm described here.
  • The paper itself can be found here
  • This is a probabilistic algorithm optimized for memory usage, making it ideal for large streams of data.

To Run

  • Pick a desired accuracy (ε)
    • This is how close you want your estimate to be to the true number of distinct elements. A larger ε means you want a more precise estimate. For example, ε = 0.95 means you want your estimate to be within 5% of the actual value.
  • Pick a confidence (1-δ)
    • This is your level of certainty that the algorithm's estimate will fall within the desired accuracy range. A higher confidence (e.g., 99.9%) means you're very sure the estimate will be accurate, while a lower confidence (e.g., 90%) means there's a higher chance the estimate might be outside the desired range.
  • Estimate the total number of words in the stream (m)
  • Input a file path
    • Put a .txt file in the input-files directory (Shakespeare's Hamlet is provided already in that directory as a sample)

Then run with

<yarn | npm | pnpm> run calc <ε> <1-δ> <m> <file path>

For example:

yarn run calc .99 .90 32000 ./input-files/hamlet-shakespeare.txt

Note

  • This is a probabilistic algorithm, so accuracy will never be 100% unless the buffer size exceeds the number of unique words in the input file.