Skip to content

Documentation for ItemsSetAugmentationApplier

Overview

The ItemsSetAugmentationApplier class is designed to enhance dataset diversity by applying a specified augmentation strategy to items within an ItemsSet. The class facilitates the generation of augmented examples that can be merged with the original dataset for further training or evaluation.

Functionality

The class provides two primary methods:

  1. _augment: This method applies the augmentation transform to each item in the provided ItemsSet. It iterates through every item, utilizes the specified augmentation's transform method on the item's field, and yields a dictionary containing the original ID alongside the generated augmented item.

  2. apply_augmentation: This method applies an augmentation on an ItemsSet instance and returns a new ItemsSet that includes both the original and the augmented items. The augmentation is executed using a transformation defined by AugmentationWithRandomSelection.

Parameters

  • augmentation: An instance of AugmentationWithRandomSelection that defines the transformation applied to each item.
  • items_set: An ItemsSet instance containing the original items. It must have the attributes: data, item_field_name, and id_field_name for proper mapping and processing.

Usage

  • Purpose: The primary purpose of the ItemsSetAugmentationApplier class is to generate additional examples, thereby enhancing the dataset's diversity for training or evaluation purposes.

Examples

Using _augment method:

augmentation = AugmentationWithRandomSelection(...)
applier = ItemsSetAugmentationApplier(augmentation)
augmented_items = list(applier._augment(items_set))

Using apply_augmentation method:

applier = ItemsSetAugmentationApplier(augmentation)
new_items_set = applier.apply_augmentation(items_set)

This documentation provides a comprehensive overview of the ItemsSetAugmentationApplier class, detailing its functionality, parameters, purpose, and usage examples for effective application in data augmentation contexts.