稀疏查找表的用处及其优势请参见SparseLUT在Github上的README.md
使用方法
通过以下命令即可安装稀疏查找表的Python包:
pip install sparse_lut
下面介绍使用稀疏查找表的方法。
首先,通过如下代码初始化稀疏查找表
from sparse_lut import SparseLUT
# initialization
lut = SparseLUT((3, 3, 3, 3, 3))
其次,通过add方法,向稀疏查找表中加入多条特征序列,例如
# adding feature-lists
lut.add([[0,1,2], [0,1,2], [0,1,2], [0,1,2], [0,1,2]], "A")
lut.add([[1,2], [0], [0,1,2], [0,1,2], [0,1,2]], "B")
lut.add([[1,2], [1], [0,1,2], [0,1,2], [0,1,2]], "C")
第三,构建稀疏查找表。如果要进一步进行可视化,则需要传入参数 False,否则,程序构建好后会将相关的中间变量清空,以至于无法进行进一步的可视化。
# building the sparse-lut
lut.build(False) # set True is visualization is not required
第四,如果需要可视化,则通过draw方法进行。
图8
第五,通过下标访问。例如
# accessing the value
result = lut[0,1,0,0,0]
print(result)
程序会打印“OrderedSet(['A'])”,即成功访问到了对应的值。
Metadata
Release files for sparse-lut 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sparse_lut-1.0.0.tar.gz | 413.1 kB | Without provenance | Details |
Release files / sparse_lut-1.0.0.tar.gz
| Download URL | sparse_lut-1.0.0.tar.gz |
|---|---|
| Size | 413.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee52ab0177f04a3e22afc62114674ed047360ce31b3d3da17c546cf133b0540c
|
|
BLAKE2b-256 checksum How to use checksums |
3e97c9f59ad1b12782ad1a2bbb6550fcbb6a2f92fb6e442a3d7b80fe54646859
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.10
|
Security for sparse-lut 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.