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.5-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (122.3 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (121.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (122.3 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (121.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (121.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (121.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (120.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lazy_k-0.1.5-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (120.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file lazy_k-0.1.5-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 013ad20495ab264c4abc40a9909cb3b91a5bdd5c7c3f5debc35574e68edc8138
MD5 6ac579ddf5577c145e21589debf4fa0f
BLAKE2b-256 d9767c28ba4aa84912f5198d4f5b86d4d2f7b94a81f355600e2b2ed5e1ef1c65

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bbe566cfa30cfc05a8b0de8292aa29b18232c92f7cedbe9486a7a220b78a0889
MD5 62e7323302183ceb8a3022f971879dc1
BLAKE2b-256 6637246d7928ea21ee8199efbc42aba68be15cc769bb34ee0d87889ec9388ce1

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.5-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 175adbe590e81639e7bae197ed019c8efd5413b73145ebb185944daba8134e05
MD5 ed1cd57312fce3ca32a3cd86a51260c5
BLAKE2b-256 c66ff7afb127299cc4cf8be370a29e314fb80beb11ba1ad8b773407112b4d9c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 72752959df9a257106dbf4fd649df500c9332d7ceafd09c1f3dc4f16caca9de8
MD5 5f85e7515d5828ece51269fa365f37d9
BLAKE2b-256 830ac45acbcf2f9f2f10ed3ef4089d66b256c207b12e4613de434b47f019f23a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 86bccddcc2e7a4750a538a2f07b4f589b125c4bbfcafbe37570c5766fe4be928
MD5 be38733963b1fffae411e043aee7b678
BLAKE2b-256 d15bf9d282b6660416325ac792edff32aa91bf4d14ea5eb42a9c507eb96254ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6c63390cdb164a61691e9d19f0de182b0f5dd2e9a7f54d9b27d537c5682380f4
MD5 605e514974baa72353859a506e805726
BLAKE2b-256 7e03667f22cc4390bd7f89a41e4b17d3e81ad78d0f7ac55fb1d8fe68c49b710f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fb312e8a35e51828df45c938554b59a376c5b0b06901786002fda678d4a5cf95
MD5 cbff08aeba6c2f2b9061ea3280c3fdb7
BLAKE2b-256 520ce0fac2b1145df07231c2e122dbc679527b547ccff39f0923b16b276afc26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.5-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 20e906fb9f5404ea5103dcda3c9f7a9f65f14d7bb1f8bfd48ad2ebd5a2608f47
MD5 a5bff13758857121aa5625c953cc544d
BLAKE2b-256 9688d91841134b642d96d85ce7069a5f70450ca7181d50b3a3b585a3137bcf5b

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