A hyper label model to aggregate weak labels from multiple weak supervision sources to infer the ground-truth labels in a single forward pass
Project description
Hyper label model
A hyper label model to aggregate weak labels from multiple weak supervision sources to infer the ground-truth labels in a single forward pass.
For more details, see our paper Learning Hyper Label Model for Programmatic Weak Supervision
** To reproduce experiments of our paper or to re-train the model from scratch, please switch to the paper_experiments branch.
How to use
-
Install the package
pip install hyperlm
-
Import and create an instance
from hyperlm import HyperLabelModel
hlm = HyperLabelModel()
- Unsupervised label aggregation. Given an weak label matrix
X
, e.g.X=[[0, 0, 1], [1, 1, 1], [-1, 1, 0], [0, 1, 0]]
, you can infer the labels by:
pred = hlm.infer(X)
Note in X
, -1
represents abstention, 0
and 1
represent classes. Each row of X
includes the weak labels for a data point, and each column of X
includes the weak labels from a labeling function (LF).
- Semi-supervised label aggregation. Let's say the gt labels are provided for the examples at index 1 and 3, i.e.
y_indices=[1,3]
, and the gt labels arey_vals=[1, 0]
. We can incorporate the provided partial ground-truth with:
pred = hlm.infer(X, y_indices=y_indices,y_vals=y_vals)
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
Built Distribution
File details
Details for the file hyperlm-0.0.5.tar.gz
.
File metadata
- Download URL: hyperlm-0.0.5.tar.gz
- Upload date:
- Size: 91.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 999557319314e9c9c99e5b93754fc960fa35d580c63e4a50b23c0f5fc041e127 |
|
MD5 | 8d897c5080a2d70082d6681c39f4f323 |
|
BLAKE2b-256 | a25b36bef1cfba58a6b3e2857f7da87c4cf5a08926fe9fbb169f957ef12b765c |
File details
Details for the file hyperlm-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: hyperlm-0.0.5-py3-none-any.whl
- Upload date:
- Size: 91.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6bafc04076fd857798aa05cea48daa1304772b0e20a71378e6f1651fe425a42 |
|
MD5 | eb3c9ee34bd1ea265d751cd72b7f2167 |
|
BLAKE2b-256 | 7f1c9a934b6c5585b21912581de74ac89922bc76383127b9f091afbe5191583e |