Skip to main content

A C++ implementation of the Lazy-k algorithm (A* with partial expansion)

Project description

main

lazyk

A C++/Python library for efficiently iterating over high-probability label-assignments.

Installation

You know the drill

pip install lazy-k

Usage

The library can be used to iterate over the high-probability label-assignments of a given probability matrix. The following example shows how to use the library to iterate over the high-probability label-assignments of a 3x3 probability matrix.

from lazyk import lazyk
import numpy as np

probs = np.arange(1, 10).reshape(3, -1)
probs = probs / probs.sum(axis=1, keepdims=True)

for seq in lazyk(probs, cache_assignments=True): # cache_assignments is true by default, but can be turned off for lower memory usage but might be slower
    print(seq)

The cache_assignments parameter indicates whether the algorithm should cache the intermediate label-assignments. This will improve the running speed of the algorithm but also require more memory. The default value is True but can be turned off if memory is a concern.

More information can be found in the paper "Lazy-k Decoding: Constrained Decoding for Information Extraction".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lazy_k-0.1.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

lazy_k-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lazy_k-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lazy_k-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (128.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lazy_k-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (128.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lazy_k-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (128.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file lazy_k-0.1.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ec022a111fe2b728ca5d19683332392693c884ffc246642902cc9246a83faad
MD5 caa3e6ae52e5d4cc9c809dd348c8f281
BLAKE2b-256 0d0f8148635b20d1bb80277d22a1706a2913cd3e99e23b8e9e85dc84daca460f

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ac8bdd2d8d7c0ba57d4b86fd79e6fa25a8db107b8fbd249ff1ee1e472376605
MD5 207035676564f3d3a5c943a666a8d117
BLAKE2b-256 7b1bb51f7b7642c62b1d3321c0b4ef3bd13978c2d76c19077063d11f0e18febc

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24ea0af997fe140690230cae7d3d10d6446541c14d7111fed1ba49733c65b62a
MD5 76c2efba0b7f60511173edc1ba3db6ef
BLAKE2b-256 cfdb3db38a3cd8c71c82cdb0bf50d942c9dfb0e48453bd88aaea603a889fe5b6

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69096b3479e76b01a3b6025e777e31956b6c6fa73464cfed26e3bf21a764b47e
MD5 92d7745373cc74e32f837640841310ad
BLAKE2b-256 2d3214378d16760ff08c96e14725ac287671bc08782d9907ae074dc9ea2d7820

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04cb2765f3a9cdc4a91e13cfa5a258bc7c336b66f90e77a29e63eb76ec55f416
MD5 880bb91374730841d15adf524b218fe4
BLAKE2b-256 031bf7cdeba3da9221eb5253a0a55428d897c60548c2976e6e9e0c1e30a6e127

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8132562b91be9dc4bd1c0079883d869f2611b733d0e83bca77cc099c262ef274
MD5 2ed4e62b984f69c958b6f2fe986cbc92
BLAKE2b-256 ca3f1c53231a1282e5525dc05efc51d0667d7ee9699176cdf4b17125da81328a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page