# 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
### Using PyPi
From PyPi you can install this with just
```
pip3 install lilcom
```
### Using Github Repository
To install lilcom first clone the repository;
```
git clone git@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).
To test it, you can then cd to `test` and run:
```
python3 test_interface.py
```
### How to use this compression method
The most common usage pattern will be as follows (showing Python code):
```
# Let a be a NumPy ndarray with type np.float32 or np.float64
# compress a.
import lilcom
a_compressed = lilcom.compress(a)
# decompress a
a_decompressed = lilcom.decompress(a_compressed)
```
Note: the compression is lossy so `a_decompressed` will not be
exactly the same as `a`. The amount of error is determined
by the optional `tick_power` argument to lilcom.compress();
the maximum error per element is 2**(tick_power-1), e.g.
for tick_power=8, the maximum error per element is 1/512.
## Technical details
The algorithm regresses each element on the previous element (for a 1-d array)
or, for general n-d arrays, all the previous elements along all 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 core parts of the code are implemented in C++.
PyPI 官网下载 | lilcom-1.0.0.tar.gz
版权申诉
153 浏览量
2022-01-12
23:12:41
上传
评论
收藏 24KB GZ 举报
![avatar](https://profile-avatar.csdnimg.cn/277f6345dca0446498fbbc03843436aa_qq_38161040.jpg!1)
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
最新资源
- Delphi 12 控件之unidac-10.2.1-d29pro.exe
- keyword.other.package.java
- Apple//DTD PLIST 1.0//EN
- comment.block.documentation.rust
- there is no way to distinguish perfectly
- 数据库管理工具:dbeaver-ce-24.0.2-x86-64-setup.exe
- Objective-C.tmLanguage
- 数据库管理工具:dbeaver-ce-24.0.2-macos-x86-64.dmg
- Delphi 12 控件之StyleControls 5.77.7z
- 苹果CMSV10红色自适应网站模板
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)