A C++ implementation of the Lazy-k algorithm (A* with partial expansion)
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for lazy_k-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f33a9739e6f0e817d1bffbfb56bf57531a487a5d0346039cef2f8e87d6c7b68 |
|
MD5 | 9a0b98bd0f3d778a493b916938786743 |
|
BLAKE2b-256 | 839584cc0026bf4f2cdb9765871e03abdafed97f5a73acdbb9cef0cc4d9db70c |