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)
Metadata
Release files for hyperlm 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hyperlm-0.0.5.tar.gz | 91.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hyperlm-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 183.2 kB
Release files / hyperlm-0.0.5.tar.gz
| Download URL | hyperlm-0.0.5.tar.gz |
|---|---|
| Size | 91.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
999557319314e9c9c99e5b93754fc960fa35d580c63e4a50b23c0f5fc041e127
|
|
BLAKE2b-256 checksum How to use checksums |
a25b36bef1cfba58a6b3e2857f7da87c4cf5a08926fe9fbb169f957ef12b765c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / hyperlm-0.0.5-py3-none-any.whl
| Download URL | hyperlm-0.0.5-py3-none-any.whl |
|---|---|
| Size | 91.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6bafc04076fd857798aa05cea48daa1304772b0e20a71378e6f1651fe425a42
|
|
BLAKE2b-256 checksum How to use checksums |
7f1c9a934b6c5585b21912581de74ac89922bc76383127b9f091afbe5191583e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|