Math and science::INF ML AI
The two types of compressors
There are only two ways in which a purported compressor can compress files. Each makes a trade-off.
- Lossy compression
- A lossy compression compresses some (possibly all) files, but it maps some files to the same encoding. When decompression if an ambiguous files is encountered, there is no way to know for sure which of the multiple files having that encoding was the original file.
- Lossless compression
- A lossless compressor maps all files to different encodings; if it shortens some files, it necessarily makes others longer. A good compressor is one where the probability of a file is lengthened is small, while the probability that a file is shortened is large.