caikit.core.augmentors ====================== .. py:module:: caikit.core.augmentors .. autoapi-nested-parse:: Augmentors apply different types of data augmentation to data model objects, or data streams of data model objects. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/caikit/core/augmentors/base/index /autoapi/caikit/core/augmentors/merged_augmentor/index /autoapi/caikit/core/augmentors/schemes/index Classes ------- .. autoapisummary:: caikit.core.augmentors.AugmentorBase caikit.core.augmentors.MergedAugmentor caikit.core.augmentors.AlwaysSelectionScheme caikit.core.augmentors.SchemeBase caikit.core.augmentors.RandomMultiSelectionScheme caikit.core.augmentors.RandomSingleSelectionScheme Package Contents ---------------- .. py:class:: AugmentorBase(random_seed, produces_none=False) .. py:attribute:: produces_none :value: False .. py:method:: augment(inp_obj) Take an object in, give an object back. Calls ._augment in the subclass. Args: inp_obj (str | caikit.core.data_model.DataBase): Object to be augmented. Returns: str | caikit.core.data_model.DataBase: Augmented object of same type as input inp_obj. .. py:method:: reset() Reset random number generation for the current augmentor. Note that this currently assumes the augmentor is using the builtin random generator leveraged by Python; if you end up using something else, you may want to override this or restructure this base class to allow resetting of random states based on seed type. .. py:class:: MergedAugmentor(scheme) Bases: :py:obj:`caikit.core.augmentors.base.AugmentorBase` .. py:attribute:: _scheme .. py:attribute:: augmentor_type .. py:method:: _augment(obj) Apply a merged augmentor whose behavior is controlled by the encapsulated scheme. Args: obj (str | caikit.core.data_model.DataBase): Object to be augmented. Returns: str | caikit.core.data_model.DataBase: Augmented object of same type as input obj. .. py:method:: reset() Reset the merge augmentor's random number generation. In this case we actually don't need to care about the augmentor random state; what matters for this is the augmentor. scheme. .. py:class:: AlwaysSelectionScheme(preserve_order, augmentors, random_seed=1001) Bases: :py:obj:`caikit.core.augmentors.schemes.base.SchemeBase` .. py:method:: _execute(obj) Execute the merged scheme by always applying every contained augmentor (in a potentially shuffled ordering, based on the value of self.preserve_order). Args: obj (str | caikit.core.data_model.DataBase): Object to be augmented. Returns: str | caikit.core.data_model.DataBase: Augmented object of same type as input obj. .. py:class:: SchemeBase(preserve_order, augmentors, random_seed) .. py:attribute:: _preserve_order .. py:attribute:: _current_order .. py:attribute:: _augmentors .. py:attribute:: _init_state .. py:method:: execute(obj) Execute the merged scheme, i.e., augment the object by leveraging the encapsulated augmentors. Args: obj (str | caikit.core.data_model.DataBase): Object to be augmented. Returns: str | caikit.core.data_model.DataBase: Augmented object of same type as input obj. .. py:method:: reset() Reset the random state of all encapsulated augmentors and the scheme itself. .. py:class:: RandomMultiSelectionScheme(preserve_order, selection_probs, augmentors, random_seed=1001) Bases: :py:obj:`caikit.core.augmentors.schemes.base.SchemeBase` .. py:attribute:: _selection_probs .. py:method:: _execute(obj) Execute the merged scheme by sequentially applying augmentors (in a potentially shuffled ordering, based on the value of self.preserve_order). Args: obj (str | caikit.core.data_model.DataBase): Object to be augmented. Returns: str | caikit.core.data_model.DataBase: Augmented object of same type as input obj. .. py:class:: RandomSingleSelectionScheme(selection_probs, augmentors, random_seed=1001) Bases: :py:obj:`caikit.core.augmentors.schemes.base.SchemeBase` .. py:attribute:: _selection_probs .. py:method:: _execute(obj) Execute the merged scheme by picking one random augmentor and applying it. Args: obj (str | caikit.core.data_model.DataBase): Object to be augmented. Returns: str | caikit.core.data_model.DataBase: Augmented object of same type as input obj.