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.
You can run the script as follows:
python weissman.py -c <command> -i <input> -o <output> -a <alpha> -r <reps>
Where:
commandis the command to launch the target compression algorithm and compress a specificinputfile into theoutputfile. This command must keep the original (uncompressed) fileinputis the path to the uncompressed file used in the testoutputis the path to the compressed file generated bycommandalphais the scaling parameter of the Weissman scorerepsis 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)