Python implementation of Hierarchical Label Propagation (HLP)
Project description
Hierarchical Label Propagation (HLP)
Implementation of Hierarchical Label Propagation (HLP) in python.
Installation
This code is included in the hierarchical-label-propagation package. To install it, you can run the following command:
pip install hierarchical-label-propagation
Usage
The hierarchical-label-propagation package provides a class called HLP that can be used to run the Hierarchical Label Propagation algorithm. The following code snippet shows how to use it:
from hierarchical_label_propagation import HLP
hlp = HLP() # Creates an instance with the default HLP method for AudioSet.
HLP can now be applied to the AudioSet targets. Using the same API, it can either be done to the target of a single example or to the targets of a batch of examples. The following code snippet shows how to apply HLP:
y = hlp.propagate(y) # Propagates the labels of a single example.
or
X, Y, file_names = batch
Y = hlp.propagate(Y) # Propagates the labels of a batch of examples.
Please note that hlp.propagate() takes a 1D (# classes) or 2D (Batch Size, # classes) torch.Tensor as an input and returns the propagated labels as a torch.Tensor of the same shape as the input.
the propagate method can also be used to propagate on continuous values using the same API. This is true if and only if a higher value indicates a higher confidence in the label. This can be useful to apply HLP to the output of a classifier as a post-processing step.
Citation
If you use this code in your research, please consider citing the following paper:
Citation will be added soon.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hierarchical_label_propagation-0.1.0.tar.gz.
File metadata
- Download URL: hierarchical_label_propagation-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3eba548716d6b45556b861799115de66e18a6d33c653fa470d3559cbd53b2234
|
|
| MD5 |
7d1e6bfe71a51ffea25f138d856340fa
|
|
| BLAKE2b-256 |
cebccf2e077f6fea127d2ede1835023c467b692128fb874ad5fd97cf34fdfcc0
|
File details
Details for the file hierarchical_label_propagation-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hierarchical_label_propagation-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc6e0310e8f1967895e9bd3a255a422b49bad5a1654def04eb8586ec87d61d8a
|
|
| MD5 |
f4a8f01eff550a60d76cc715bf97dd65
|
|
| BLAKE2b-256 |
447421a7b6da9a7b74dced343ec6b7ce511d59175c6ebce2892f5ca0a673748e
|