Metadata Function

For each sample, Tensorleap allows extra data to be added for future analysis. Each defined data is wrapped in a metadata function.

from code_loader.contract.datasetclasses import PreprocessResponse

def metadata_label(idx: int, preprocess: Union[PreprocessResponse, list]) -> Union[int, float, str, bool]:
    return preprocess.data.iloc[idx]['class_name']

You can add additional custom metadata that will later be available for each sample to help with analysis. This function is called for each evaluated sample.

These functions should return one of the following types: int, float, str or bool.

Usage within the full script can be found at the Integration Script.

Guides

Full examples can be found at the Dataset Integration section of the following guides:

Last updated