https://github.com/lorenzosaino/weissman-score
  
  
    Weissman score calculator 
    https://github.com/lorenzosaino/weissman-score
  
compression-algorithm silicon-valley weissman-score
        Last synced: 7 months ago 
        JSON representation
    
Weissman score calculator
- Host: GitHub
- URL: https://github.com/lorenzosaino/weissman-score
- Owner: lorenzosaino
- License: other
- Created: 2014-06-03T00:45:38.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-04-18T11:37:06.000Z (over 4 years ago)
- Last Synced: 2025-03-28T19:44:45.099Z (7 months ago)
- Topics: compression-algorithm, silicon-valley, weissman-score
- Language: Python
- Size: 6.84 KB
- Stars: 123
- Watchers: 11
- Forks: 20
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
- License: LICENSE.txt
 
Awesome Lists containing this project
README
          # 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](http://online.wsj.com/news/articles/SB10001424052702303987004579479244213599118) and [here](http://spectrum.ieee.org/view-from-the-valley/computing/software/a-madefortv-compression-metric-moves-to-the-real-world).
## Usage
You can run the script as follows:
    python weissman.py -c  -i  -o  -a  -r 
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)