Skip to main content

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


Download files

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

Source Distribution

hierarchical_label_propagation-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file hierarchical_label_propagation-0.1.0.tar.gz.

File metadata

File hashes

Hashes for hierarchical_label_propagation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3eba548716d6b45556b861799115de66e18a6d33c653fa470d3559cbd53b2234
MD5 7d1e6bfe71a51ffea25f138d856340fa
BLAKE2b-256 cebccf2e077f6fea127d2ede1835023c467b692128fb874ad5fd97cf34fdfcc0

See more details on using hashes here.

File details

Details for the file hierarchical_label_propagation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hierarchical_label_propagation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc6e0310e8f1967895e9bd3a255a422b49bad5a1654def04eb8586ec87d61d8a
MD5 f4a8f01eff550a60d76cc715bf97dd65
BLAKE2b-256 447421a7b6da9a7b74dced343ec6b7ce511d59175c6ebce2892f5ca0a673748e

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