snorkel.augmentation.ApplyAllPolicy

class snorkel.augmentation.ApplyAllPolicy(n_tfs, n_per_original=1, keep_original=True)[source]

Bases: snorkel.augmentation.policy.core.Policy

Apply all TFs in order to each data point.

While this can be used as a baseline policy, using a random policy is more standard. See RandomPolicy.

Parameters
  • n_tfs (int) – Total number of TFs

  • n_per_original (int) – Number of transformed data points for each original data point

  • keep_original (bool) – Keep untransformed data point in augmented data set? Note that even if in-place modifications are made to the original data point by the TFs being applied, the original data point will remain unchanged.

Example

>>> policy = ApplyAllPolicy(3, n_per_original=2, keep_original=False)
>>> policy.generate_for_example()
[[0, 1, 2], [0, 1, 2]]
n[source]

Total number of TFs

n_per_original[source]

See above

keep_original[source]

See above

__init__(n_tfs, n_per_original=1, keep_original=True)[source]

Initialize self. See help(type(self)) for accurate signature.

Return type

None

Methods

__init__(n_tfs[, n_per_original, keep_original])

Initialize self.

generate()

Generate indices of all TFs in order.

generate_for_example()

Generate all sequences of TF indices for a single example.

generate()[source]

Generate indices of all TFs in order.

Returns

Indices of all TFs in order.

Return type

List[int]

generate_for_example()[source]

Generate all sequences of TF indices for a single example.

Generates n_per_original sequences, and adds an empty sequence if keep_original is True.

Returns

Sequences of indices of TFs to run on data point in order.

Return type

List[List[int]]