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.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (135.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

lazy_k-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (135.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lazy_k-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lazy_k-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (134.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lazy_k-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (134.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lazy_k-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (135.8 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 591d480546589c8557645aec3c3b14d4af1c821e5266e26e491aee5858a2e255
MD5 2fd495de68c6f39766f4cecec16d5683
BLAKE2b-256 226ac0b66b5e7a489b48786fe92b9327203080383c55f0f462a9250f233f7d80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ceb13b2194880a7bfd1c52166402d4cb0bb6499290a33315dc21c2a65e710002
MD5 17b113361c561d74dc6c8e1f22bdcb97
BLAKE2b-256 42d5793bc6a81c831fbdec3caf7645dc10fe61bf1e3f37161b872abf0a2ed28d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 20b910ba654dfc634982de5bc6f875f75bf2d0e0f1a3914bf44f62ad5c5323bf
MD5 94334b5d080deaaa2cfe28339cedb11b
BLAKE2b-256 9fed067298ace8108a005ab5dfbe1e8869b8ff6d083c0df7422effbbbf01a849

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a5185c8838ada49fee1caa4cd44267265617fa14fdc11c8945b80e867e7f242
MD5 7df840a12c6558bf42216701c698bf7c
BLAKE2b-256 1b6b2579bda1949b481c0f1c0b258d017409766e7477c537c17691c0ee3145f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lazy_k-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8c1475cfb84f9731e4892ee53a1dc5950851fd5619355851f983789d85b24de
MD5 ec37a18044324ad6e49849fa938cb309
BLAKE2b-256 204a4737294d850bdf73d50a6d8d61cae89227c1193f40027931738588d57b9e

See more details on using hashes here.

File details

Details for the file lazy_k-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lazy_k-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d84c6eef5c8b24beba13a2b9de41230f3ad86da517fb15f783b993cdafb9d866
MD5 52a468c65861ba9f62c2a5b2b8038725
BLAKE2b-256 e3d184e36e0a3cf4ac2c304e570c58a51fbd1474a68f3d426cce5b3693a906eb

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