snorkel.augmentation.TFApplier¶
-
class
snorkel.augmentation.
TFApplier
(tfs, policy)[source]¶ Bases:
snorkel.augmentation.apply.core.BaseTFApplier
TF applier for a list of data points.
Augments a list of data points (e.g.
SimpleNamespace
). Primarily useful for testing.-
__init__
(tfs, policy)[source]¶ Initialize self. See help(type(self)) for accurate signature.
- Return type
None
Methods
__init__
(tfs, policy)Initialize self.
apply
(data_points[, progress_bar])Augment a list of data points using TFs and policy.
apply_generator
(data_points, batch_size)Augment a list of data points using TFs and policy in batches.
-
apply
(data_points, progress_bar=True)[source]¶ Augment a list of data points using TFs and policy.
- Parameters
data_points (
Sequence
[Any
]) – List containing data points to be transformedprogress_bar (
bool
) – Display a progress bar?
- Returns
List of data points in augmented data set
- Return type
List[DataPoint]
-
apply_generator
(data_points, batch_size)[source]¶ Augment a list of data points using TFs and policy in batches.
This method acts as a generator, yielding augmented data points for a given input batch of data points. This can be useful in a training loop when it is too memory-intensive to pregenerate all transformed examples.
- Parameters
data_points (
Sequence
[Any
]) – List containing data points to be transformedbatch_size (
int
) – Batch size for generator. Yields augmented data points for the nextbatch_size
input data points.
- Yields
List[DataPoint] – List of data points in augmented data set for batches of inputs
- Return type
Iterator
[List
[Any
]]
-