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 Distributions
Built Distributions
Hashes for lilcom-1.6-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a23c481c011faedb4f3e2bdeafc247031cbfc531dd7c3d1bce3c0cd63551232 |
|
MD5 | 25ced11553141af192c4c0d7bf09015b |
|
BLAKE2b-256 | 8fb8e75ca31028b552132aaf596cccc015444550bb28a2dff3e643e974c88049 |
Hashes for lilcom-1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ceb92695355a6df154471531b916934b738375318880e4ee0c89e027b6846c3 |
|
MD5 | d63b221afe0a8f8bfcd5820e95593a6e |
|
BLAKE2b-256 | a7cd2bc6bc5fdf7743f9c9076f41adb5f41e42212691313b4cb5aec06cdcc512 |
Hashes for lilcom-1.6-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 206717eb36e36d2681b7f051a034166aed30ae639e38d2351735cc305fc976d4 |
|
MD5 | 437572aa14f8235c6f0aa146059d5208 |
|
BLAKE2b-256 | bf4e401dce1638dfc1af291f0e88d10c71d6ea41d3489439d99d88a2562f7e4b |
Hashes for lilcom-1.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de755be85f59666ced2a9fcf924997d2ff236faeb21b859a7993d68df5204eed |
|
MD5 | 83b8bf513fdc043c5cae089c11da01ea |
|
BLAKE2b-256 | 94fe3565890f02d7daac1ead80a281d43922a5d4611686b470783e101daf4a09 |
Hashes for lilcom-1.6-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 408013c71c2d61113135e7270b0fdb0397d45258264fb2bbbc6b5e7fb9859274 |
|
MD5 | ab144c8ec2c018a078e74edb670fefff |
|
BLAKE2b-256 | 1a2b025548ba44d9293931a4620ab308d64ee6526ee7210f35dbecfc42b947a7 |
Hashes for lilcom-1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc9be9f335d29e57098a010352ca474194ea87425d8dc0257d92776e96fba824 |
|
MD5 | f798de46e84e4be2a55000ccb6dd90f8 |
|
BLAKE2b-256 | f81116caf117998dfd211a9a830324adb4879b215a47d68f72fa2b0e62c7c0e3 |
Hashes for lilcom-1.6-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dc8bf37d3b8b8d52351cb653504f34e7efedbabf015842b0c497a9e857e50a7 |
|
MD5 | d03eaa60a1d7aacada4e5208bce3c2d2 |
|
BLAKE2b-256 | 3db94967545fae23f30bc05a45158fe2711a281cbb345444bd0a293d13469de1 |
Hashes for lilcom-1.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70bb3d55aacd265b4c47c6253c4cfa66ae9daf8751fb2634e73e0c15153349dc |
|
MD5 | d23682695af1d4ff528c235db7283da7 |
|
BLAKE2b-256 | 754e05db28d231943df9ab22c343f0050bbb11ad5db1caa62b3d2f6f49893aed |
Hashes for lilcom-1.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03f41a3fa5983f354b53e3554b78836318ae484a908aac676e33d6081a600152 |
|
MD5 | edcfd06957b268dd172609ccd87ab54d |
|
BLAKE2b-256 | e219bb3a9f4e1a7e96e0746099a9c3162b7892cbc971494e7c587162db5cefde |
Hashes for lilcom-1.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 198d4b2e577437d9012131d39af9ffd1b326ba8d648fc3adaa15ab676c725769 |
|
MD5 | 1467f0a0e45b95cf24e9828618324f69 |
|
BLAKE2b-256 | 702f651fdacf0a64e02bfe52fe752df52aa8ef2f3624822b5d3c1a451350fe30 |
Hashes for lilcom-1.6-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82b3022396dc3670d150754439ab565461e4cad72bb1bb8d1eb9c5971c4e3045 |
|
MD5 | 9182c12027349f90fb100b8c88583e29 |
|
BLAKE2b-256 | b688b7782a244cce37ae0a5bdc9df71dad4df84535d55f77db016561e889eda9 |
Hashes for lilcom-1.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e44c4f45c11712264bfed74847c099ac6adc6cc3ea6489acdbe360f586d01ffb |
|
MD5 | 2e65bce6fa5475999548192b2a4d43ae |
|
BLAKE2b-256 | ccbc0e54cb65f1125f79e945a5a2a2d1755ea1221a411d1b742aea626d596074 |
Hashes for lilcom-1.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9368e10317daea78d6b94f193ac5c024b565c42e067ac86298992a0c240e4f3a |
|
MD5 | ee8b823de330d7adff3b7be62a0b7a37 |
|
BLAKE2b-256 | afaf5697083fea9da487fff71b7563dbe689b69cbd07b5df38c052cb6d102044 |
Hashes for lilcom-1.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d3539465821444471d891cf7eec5e375e3b453518cccc4af20e6f3060479807 |
|
MD5 | 046afbfb19b54a08bc001c46965af41b |
|
BLAKE2b-256 | ad076c1b16cb4f34f9d66bd7411ae376c64ea52fd1179ceed41874dfa90d71c3 |
Hashes for lilcom-1.6-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7e881d067de958ceb6a4da48c3723690834e674482c3b91333d13700324a8bc |
|
MD5 | fd3cd211d3578d5784170f9e1d10b16b |
|
BLAKE2b-256 | 2d829ba5e8ecbfa4d88f2837fbb382ea630edbfba4ba3225376bcc9c1bf4a32b |
Hashes for lilcom-1.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c78a7e2a37bbd835f234b7f121dac2d5f321e2c23160f3a83147ec1d305486f |
|
MD5 | 3709a0dc1b52c27332c086d47147ce48 |
|
BLAKE2b-256 | 2886fa8350fde2d2fcbec007044116e0414fdfd2c19170754eed2193d478cfbe |
Hashes for lilcom-1.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee8cc65778712c7ef47d64888c348ffb5fe9e53b543d782c7a684cd0570eff8a |
|
MD5 | cdcdae9f5f485314d30c8fbdbf8e4705 |
|
BLAKE2b-256 | 0fba921c6ce948566018509e160ed0fd47995275bbc110370f7e06d10c3b91ac |
Hashes for lilcom-1.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d97bdac8f56171dd418750b7ea6e6fcf5ceeb79c44574cf11f7397167bab1dce |
|
MD5 | 2aa8ebe043ee45fda38a414ab0ff4648 |
|
BLAKE2b-256 | 5e933ab832c7a68209b89e0e3788224517c22404090eb4effb642b35d6aae8e0 |
Hashes for lilcom-1.6-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b5d6e5fe347a56f639feb63ac25a2f581a5541ecc5eeb95e2c4d41323d91ceb |
|
MD5 | de7a6d1d81523c44a9743efa341ad913 |
|
BLAKE2b-256 | 427712680c56c0504280c0d6f8350e12356c296d1f59ceb4dc4a16ff440f707f |
Hashes for lilcom-1.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53af5f5db41b7392425dd5a3d6ee833c11ebbd34f9c92a6c4e6dcfbaccba995f |
|
MD5 | 6faa6b91d3d92e0bb7d24800a5c49690 |
|
BLAKE2b-256 | 04f8f49b94f51d68ab37809c23ca6d33fe683aa5cd2533c718b04d0e94daa54d |
Hashes for lilcom-1.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 755081a6ba33bac7cf852e7c52801f1e7ae230c2e0ee8ccc234283e65652da4b |
|
MD5 | fa4eff182eca9341ee764a6f613181a1 |
|
BLAKE2b-256 | eeec125d6ff0eeffb18ce42befd8f2b79c957a5ec9eb015d6012a33daf94287b |
Hashes for lilcom-1.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a42ef8029ba1b7ca5e25aca35e1062b522392970b69ea0ed05bd3f3c379b0bae |
|
MD5 | 3847b4a6a50ed7b29bbe496d69a4852e |
|
BLAKE2b-256 | 14e866b1f08bda2896b9895c595ee0d7bfeefb637b360d1a56cb8a1b4024c2c4 |
Hashes for lilcom-1.6-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90c43e8144f89432e1acc97eb5758d6638a4e02f8a3380376fcc1affdd6fda45 |
|
MD5 | 16dccbc9c9726eb048d1177b93bc6307 |
|
BLAKE2b-256 | 76cfefe97163316acb58ca6a3179eda4bb64d087fbbcaa946e3602d6568f3cb6 |
Hashes for lilcom-1.6-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07ad3469f0e5904ec4973090aab09a93621a941113aa9d76e94ad2d7d31571e2 |
|
MD5 | bf4e44648ed1de5524e41ebc0f69a77b |
|
BLAKE2b-256 | 029e4d3450c70b6c3870c004284290b07dbfccc0fdeea47a1036a1b2eca4ac41 |