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.2.tar.gz
.
File metadata
- Download URL: hyperlm-0.0.2.tar.gz
- Upload date:
- Size: 92.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7d11b996b343cd4140d9793e49d5a0a29ae6c06b814a886a257dbe32e000eec |
|
MD5 | 8072cc74541f5522ec6a31e2b947389c |
|
BLAKE2b-256 | f108d4c601461f6638727da9fe78b79e0cf1e74be2c6789193190faf084c9999 |
File details
Details for the file hyperlm-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: hyperlm-0.0.2-py3-none-any.whl
- Upload date:
- Size: 91.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f49481a78cd2cdf87ef837d6d3c3d58f50c4c5fa576b96d0027357c13e48d8 |
|
MD5 | 1d1b151dafb1dcab6e19418550031d1f |
|
BLAKE2b-256 | af0c54819d1ad0480e84fca07a414c95a61417efc5942af041bee9e8e0125863 |