Semi-supervised learning¶
Collection of utilities for semi-supervised learning where some part of the data is labeled and the other part is not.
Note
We rely on the community to keep these updated and working. If something doesn’t work, we’d really appreciate a contribution to fix!
Balanced classes¶
Example:
from pl_bolts.utils.semi_supervised import balance_classes
- pl_bolts.utils.semi_supervised.balance_classes(X, Y, batch_size)[source]
Warning
The feature balance_classes is currently marked under review. The compatibility with other Lightning projects is not guaranteed and API may change at any time. The API and functionality may change without warning in future releases. More details: https://lightning-bolts.readthedocs.io/en/latest/stability.html
Makes sure each batch has an equal amount of data from each class. Perfect balance.
half labeled batches¶
Example:
from pl_bolts.utils.semi_supervised import balance_classes
- pl_bolts.utils.semi_supervised.generate_half_labeled_batches(smaller_set_X, smaller_set_Y, larger_set_X, larger_set_Y, batch_size)[source]
Warning
The feature generate_half_labeled_batches is currently marked under review. The compatibility with other Lightning projects is not guaranteed and API may change at any time. The API and functionality may change without warning in future releases. More details: https://lightning-bolts.readthedocs.io/en/latest/stability.html
Given a labeled dataset and an unlabeled dataset, this function generates a joint pair where half the batches are labeled and the other half is not.