Lossy-compression utility for sequence data in NumPy
Project description
lilcom
This package lossily compresses floating-point NumPy arrays into byte strings, with an accuracy specified by the user. The main anticipated use is in machine learning applications, for storing things like training data and models.
This package requires Python 3 and is not compatible with Python 2.
Installation with PyPi
From PyPi you can install this with just
pip3 install lilcom
Installation with conda
conda install -c lilcom lilcom
How to use
The most common usage pattern will be as follows (showing Python code):
import numpy as np
import lilcom
a = np.random.randn(300,500)
a_compressed = lilcom.compress(a)
# a_compressed is of type `bytes`, a byte string.
# In this case it will use about 1.3 bytes per element.
# decompress a
a_decompressed = lilcom.decompress(a_compressed)
The compression is lossy so a_decompressed
will not be exactly the same
as a
. The amount of error (absolute, not relative!) is determined by the
optional tick_power
argument to lilcom.compress() (default: -8), which is the
power of 2 used for the step size between discretized values. The maximum error
per element is 2**(tick_power-1), e.g. for tick_power=-8, it is 1/512.
Installation from Github
To install lilcom from github, first clone the repository;
git clone https://github.com/danpovey/lilcom.git
then run setup with install
argument.
python3 setup.py install
(you may need to add the --user
flag if you don't have system privileges).
You need to make sure a C++ compiler is installed, e.g. g++ or clang.
To test it, you can then cd to test
and run:
python3 test_lilcom.py
Technical details
The algorithm regresses each element on the previous element (for a 1-d array)
or, for general n-d arrays, it regresses on the previous elements along each of
the axes, i.e. we regress element a[i,j]
on a[i-1,j]
and a[i,j-1]
. The
regression coefficients are global and written as part of the header in the
string.
The elements are then integerized and the integers are compressed using an algorithm that gives good compression when successive elements tend to have about the same magnitude (the number of bits we're transmitting varies dynamically acccording to the magnitudes of the elements).
The core parts of the code are implemented in C++.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for lilcom-1.8.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351d8875f12d98a5c51e21ac9fb3d19b027441354812cc8c0b64960e8f182cc2 |
|
MD5 | 7cee4d3db049488956cbe8adf4112e1c |
|
BLAKE2b-256 | 29deffb15d340d4daed2e98fca0b5cc4cc46690704c8c53d2ab63321797780d6 |
Hashes for lilcom-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a99b0982e5d926b0653cda596d4098a796d2a1aac1904047086e1220d5dd47c2 |
|
MD5 | 240ef4cdb6d4e07bcf1216af3067f1bd |
|
BLAKE2b-256 | 4e91cc9eb1898bf37df740e6cf991e3dd9d0c109a6b33c0e188ba3fb089e5fa7 |
Hashes for lilcom-1.8.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e790ae7d9de08693e25e0ca7681864336707f746621e386d7089c2b8ae9aa07 |
|
MD5 | 32a86771e999d961769ce2dc7363b2fd |
|
BLAKE2b-256 | f3c19fbbe6ca15a39cd54bbc40a46df63a815cf8aeb1d735916a5fc22b1bcdae |
Hashes for lilcom-1.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86889c071ae223bd5e9c4c943b2571625c2c46022a8808e3a4d266f29cfaaca9 |
|
MD5 | f8d8ee6bd4dabd2cc4160addd93520eb |
|
BLAKE2b-256 | 801ec72573714fe3c3f392502089e5dce49d6184b0b31ce6549e28b41fb3a23b |
Hashes for lilcom-1.8.0-cp312-cp312-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90203a51327b3518f9469ad2d0dbcf313b6b29782d9356db7c08fe9dc11e4749 |
|
MD5 | 33f5eefb231ee9fea91fe2df7d1fe06b |
|
BLAKE2b-256 | aec2da9ce04109843586974793009a4fe66913d27015e7ffc67301f47551be01 |
Hashes for lilcom-1.8.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb438e47b7172edf99e72cdc23971a770bbb33adedda3b4ace62d67b5fe393e7 |
|
MD5 | e0a5450aafe3138fca299b789c375bac |
|
BLAKE2b-256 | 6fc4b8e61ca449e31e53447bdbb01c7431d17fac8a71b5a7b47ce7650a7ff21d |
Hashes for lilcom-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b105a38ac79752a05f25404e4d992063d0748659fbacc6da4229402cc3000cd |
|
MD5 | 104b558bb612d13cf9a927cba383ad6b |
|
BLAKE2b-256 | e0db278ce064b7cf5f0881f928a0b887bdc6908ca20a57c1c6b747c269713f63 |
Hashes for lilcom-1.8.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f10906449524fc55361ad3e769e54edde66178fd7690287eb7e72fae12e3f66 |
|
MD5 | 9156755e7f8769b6367676d280e92ab7 |
|
BLAKE2b-256 | 5bc392d747f2c3969946100046c51e1537b5998141454e3de877b7cf3644a7ea |
Hashes for lilcom-1.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dc185a212cf257f8b314fe6041ea92724e55f32cc8380ec1d98d3a2d66ce06d |
|
MD5 | 5555aff6064fa66c60543ca7be4dccb1 |
|
BLAKE2b-256 | 6a77b62689f1eb621feca543618fbf7e8019498f4973b1638a742f0e61713e56 |
Hashes for lilcom-1.8.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af1ceb08943a2a2941eeedd7c988b066e6c0f7a0f4a2731ee511bd6bc1c2f9ef |
|
MD5 | 6090380bbcef5194c0ff36ea4e614334 |
|
BLAKE2b-256 | c19be0f0eee1038acc5fe3fa73ea57166d09040613c11ed2a845bbdf94c04f83 |
Hashes for lilcom-1.8.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47fb72d299d1e8d2498fd88ef306a262d7a9529fec7b0a355be05c5a6de94b43 |
|
MD5 | a7c7fdcadf06441e0c5d14ac9394f478 |
|
BLAKE2b-256 | 0eee55f7ae2b35084d912285a903a7b1b448cc10aa85f572dd622caad45bd66c |
Hashes for lilcom-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5e042059474e46da4cceb833031b13cbec6ecff66cc7cc806c11679edd1384c |
|
MD5 | b8383407137316d03a9e0fd9d5e5daff |
|
BLAKE2b-256 | 30ac1a163be773eddfaaec575401ecc2229cd1d84b9acfbbd85b3e61d71a94bf |
Hashes for lilcom-1.8.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76c32a98a2059b0c3df0d99f8d8d7cf996b880c2703113f3507f3015a641d5c |
|
MD5 | cdfcff0640b0be73edd7a1821a691080 |
|
BLAKE2b-256 | dabafc3173ca7948c23dfe1df441e6ec06a651b2154ee848891050561eed3ed7 |
Hashes for lilcom-1.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 217f91148481edaff2faa9245cfa69afbd4c09896abb672d3b6fa112fb317e5a |
|
MD5 | 1dacb5349187d62e8b63361ffcb164e4 |
|
BLAKE2b-256 | 441161c0aa042982537c553322571ff7cb3807cfc1cb06c0dd87a775c9e169e3 |
Hashes for lilcom-1.8.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d51fd8127f90717d05dfc43440c5b26d16e6ffbdfb55b815652c4ffdaf27307a |
|
MD5 | 04b60bea49ce922ca7f15e2c4a8f0a8f |
|
BLAKE2b-256 | 5947d4bd563099a68dced086b9b747452f0a251fddda58d7f4d7a875c2ddaa0c |
Hashes for lilcom-1.8.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 124575bd2280e0f6745b1e0f80b963bfdfad69f19869743374f82b7923fc9188 |
|
MD5 | 7c7d42ec6809711fde6a12f94d7f86ca |
|
BLAKE2b-256 | 1b831c98546d428dd44175d2d7bc8f57472e29c07968d793f09dc01fd3000320 |
Hashes for lilcom-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4bbf2e336972e42432962b03e422846ddce4733facf894e4aa71d447c0ee99a |
|
MD5 | 8fe77793542dd31dc4d155e6078c3d2c |
|
BLAKE2b-256 | 81579a91b6f6f953cd9d20d06a4dea122f40f550fc736246ba5e92442d5eb797 |
Hashes for lilcom-1.8.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f08357c6be063284b2ab46d23fbbd2420e7b14bf14206a2a24958dd6ec084ca |
|
MD5 | 40e92bfdc1b7a629fc6296583aa803af |
|
BLAKE2b-256 | 2d412a57731cdae0ec14e07faf0dd5ba4689ce41b47de74fe5a9b6f471be4a2d |
Hashes for lilcom-1.8.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45081fa39be35d98bb154281da6850138ce8de9ec47d49cd8a8fb6925a6e6892 |
|
MD5 | c7881bad489e2626ed35f13cced293c6 |
|
BLAKE2b-256 | fe18da6207576e7bc74575f700ae58d20328c2b770e3e75a783a475b74403cb5 |
Hashes for lilcom-1.8.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73ca77b20ed91f5f4dfcc5e00879f65524c9a382ab5b07fee6a1c645ed8563fd |
|
MD5 | 7750e8c4f8e99e8ed76fcbe6a658bb9c |
|
BLAKE2b-256 | c5772a818df04650c7bd23c4a9beebb379e4aa9f03602ac398ee0b892632f87f |
Hashes for lilcom-1.8.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 222efa19fb7ba1aa9bef8bec36ee27614f82867b0c5cdca22da50005f999c4f7 |
|
MD5 | 79ea40d39aff826526f55fc6fb886154 |
|
BLAKE2b-256 | 92518900f7447f3578c125871d2a0d3263841f5b508dde9e41ef396029b601d9 |
Hashes for lilcom-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dbc66a0ba799fb1493dea7832231f651a20c2c4b65ec2c8efca673a5f5be3c5 |
|
MD5 | 33d68dcbb8a99f29d52c65a09f34a065 |
|
BLAKE2b-256 | e7f68436b7bdf79bb49f31d60416ef1ba72bc22d75c2a02a5742d43d373f28e7 |
Hashes for lilcom-1.8.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ac8488a9ea397a76e05dbaf173f28f5edbf7c2b3729a55644a636b2755afee |
|
MD5 | 6f786a2b6c7fe98b86152c495ba8df45 |
|
BLAKE2b-256 | 24a2009ea6d62d84f5a40b87ebd02e495b4d2988cf5e92dbca79da2893b4cc1d |
Hashes for lilcom-1.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a15ec28a5721bb2299960ac0e6b1cafb5e036a86b43d9c27c233e74e418fa2b |
|
MD5 | 9ac160de0a0ae8dffd22a9314d9a6570 |
|
BLAKE2b-256 | 5bdd12af2a67a8f8b4ac63f03e203f598b221b18668a6e9fa2903b878974fac5 |
Hashes for lilcom-1.8.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1fd8796fc401e9af13eb75804a49cbce523c615d89e063bbca28613f31fc951 |
|
MD5 | abdf396e9fac8a61b77c7f8de5834bd2 |
|
BLAKE2b-256 | 9a25a149607ee89f7181db343974bc97cb5baf90c1416db527c4820031999cc2 |
Hashes for lilcom-1.8.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24315f5e0e658cf354beb8220e4e1928cf492af38d478d0c29dc4be6d28ce567 |
|
MD5 | 322b32c3205624e14685a2bd5c98ace8 |
|
BLAKE2b-256 | 2802817f72ac43f4505c4dca0bb4faa2b5780ad4a2d55ebc5dce09f67c24ac91 |
Hashes for lilcom-1.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 247eb5556c9e8901c4a5470ac48b8620e7ffd5fc9e7cbb639b9aceb2f4e57326 |
|
MD5 | ecd7a8b2695ac9e053453e0437a02ad4 |
|
BLAKE2b-256 | cd921c1b95f1e91aafbe610756892a543e191265e254586516550180b6cd16d8 |
Hashes for lilcom-1.8.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc685038fac15f1c2ec99bbc8ece39b8c4d33df96ef0d9cf197bb459b2f2e015 |
|
MD5 | 587fa3778c2fc24266cf88317a4cb42c |
|
BLAKE2b-256 | f09cbdac27f625a64ccec51adf141919e9f60ccfec8717b05c20d97f609468e1 |
Hashes for lilcom-1.8.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a22617030dabd256ff804feb56d7217f94dea3c76604c0a7e253f478cbed905 |
|
MD5 | c2eaae40ec870098d55cc882b57b46b5 |
|
BLAKE2b-256 | b5632ec2fbbc2a9b096ce4d9c3f24e106c28f45e2bbd1091255377799d908e01 |
Hashes for lilcom-1.8.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd97a9ab914a5002fa61bdb4276d5d93a81a61568bdb0b28e1990947b42af32 |
|
MD5 | 374126c0fcadf3046099f3b592d976bf |
|
BLAKE2b-256 | e63bdd0042c9de56dc5994e079131e813885667975e85b163870ab3241cb7430 |
Hashes for lilcom-1.8.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06405b51f5bcd5cb9e2f14ce0c41e0608091f42293e470beacf3a99cd78f17b9 |
|
MD5 | c204d8da6660e554f7c1eb85d92f4e6c |
|
BLAKE2b-256 | 6980ce8cc2d00873cf42ceff3c01c44cfaff6c8d05ab32a72733a6da55b83eb0 |
Hashes for lilcom-1.8.0-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cce963a2086b88fb6a1eaf3423b7c894555427c45281496087d6fb94f9c9c82 |
|
MD5 | e5316d574f0bdcdb650c7e1a6914f779 |
|
BLAKE2b-256 | 8512448117131de5bdd047a3845dfdcc9b9f55d8f5cf250d59c3ed02267b0512 |
Hashes for lilcom-1.8.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12aa51aa7a13422fd88f4dd015debd364630efc745991e20e21b0ed70f282b06 |
|
MD5 | 742f6d2f6dc700725826de96a08ea204 |
|
BLAKE2b-256 | 7cb5bf3bfcd4532a129841e2e0fc74d99d19b5f07f6613eca18cd19ffd7cfa22 |