• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Python
  • License
    Other
  • Created over 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Weissman score calculator

Weissman score calculator

This repository contains a Python module to compute the Weissman Score of a compression algorithm.

The Weissman Score is a fictional performance score for lossless data compression algorithms devised by Tsachy Weissman and Vinith Misra at Stanford University and used in the HBO comedy series Silicon Valley.

The Weissman score W is computed as:

W = alpha * r/rb * log(Tb)/log(T)

where r and T refer to the compression ratio and time-to-compress of the target algorithm, rb and Tb refer to same quantities for a standard universal compressor (this implementation uses gzip) and alpha is a scaling constant.

Further information here and here.

Usage

You can run the script as follows:

python weissman.py -c <command> -i <input> -o <output> -a <alpha> -r <reps>

Where:

  • command is the command to launch the target compression algorithm and compress a specific input file into the output file. This command must keep the original (uncompressed) file
  • input is the path to the uncompressed file used in the test
  • output is the path to the compressed file generated by command
  • alpha is the scaling parameter of the Weissman score
  • reps is the number of times the experiment needs to be repeated (mean values are taken to compute the score)

A trivial usage example to compute bzip score is:

python weissman.py -c "bzip2 --keep README.md" -i README.md -o README.md.bz2 -a 1.0 -r 5

This code can also be used within a Python program:

>>> import weissman
>>> weissman.weissman("bzip2 --keep README.md", "README.md", "README.md.bz2", alpha=1.0, reps=5)