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

The library can be installed by cloning it and installing the Python package using pip.

git clone git@github.com:ArthurDevNL/lazyk.git
cd lazyk
pip install -e .

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 grid.

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
    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.

Project details


Download files

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

Source Distribution

lazy_k-0.1.1.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distributions

lazy_k-0.1.1-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

lazy_k-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl (205.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

Supported by

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