πŸ“„ fi_FIΒΆ

Note

ID: cards.amazon_mass.fi_FI | Type: TaskCard

{
    "loader": {
        "name": "fi-FI",
        "path": "AmazonScience/massive",
        "type": "load_hf"
    },
    "preprocess_steps": [
        {
            "mappers": {
                "intent": {
                    "0": "datetime_query",
                    "1": "iot_hue_lightchange",
                    "10": "qa_currency",
                    "11": "transport_traffic",
                    "12": "general_quirky",
                    "13": "weather_query",
                    "14": "audio_volume_up",
                    "15": "email_addcontact",
                    "16": "takeaway_order",
                    "17": "email_querycontact",
                    "18": "iot_hue_lightup",
                    "19": "recommendation_locations",
                    "2": "transport_ticket",
                    "20": "play_audiobook",
                    "21": "lists_createoradd",
                    "22": "news_query",
                    "23": "alarm_query",
                    "24": "iot_wemo_on",
                    "25": "general_joke",
                    "26": "qa_definition",
                    "27": "social_query",
                    "28": "music_settings",
                    "29": "audio_volume_other",
                    "3": "takeaway_query",
                    "30": "calendar_remove",
                    "31": "iot_hue_lightdim",
                    "32": "calendar_query",
                    "33": "email_sendemail",
                    "34": "iot_cleaning",
                    "35": "audio_volume_down",
                    "36": "play_radio",
                    "37": "cooking_query",
                    "38": "datetime_convert",
                    "39": "qa_maths",
                    "4": "qa_stock",
                    "40": "iot_hue_lightoff",
                    "41": "iot_hue_lighton",
                    "42": "transport_query",
                    "43": "music_likeness",
                    "44": "email_query",
                    "45": "play_music",
                    "46": "audio_volume_mute",
                    "47": "social_post",
                    "48": "alarm_set",
                    "49": "qa_factoid",
                    "5": "general_greet",
                    "50": "calendar_set",
                    "51": "play_game",
                    "52": "alarm_remove",
                    "53": "lists_remove",
                    "54": "transport_taxi",
                    "55": "recommendation_movies",
                    "56": "iot_coffee",
                    "57": "music_query",
                    "58": "play_podcasts",
                    "59": "lists_query",
                    "6": "recommendation_events",
                    "7": "music_dislikeness",
                    "8": "iot_wemo_off",
                    "9": "cooking_recipe"
                }
            },
            "type": "map_instance_values"
        },
        {
            "field_to_field": {
                "intent": "label",
                "utt": "text"
            },
            "type": "rename_fields"
        },
        {
            "fields": {
                "classes": [
                    "datetime_query",
                    "iot_hue_lightchange",
                    "transport_ticket",
                    "takeaway_query",
                    "qa_stock",
                    "general_greet",
                    "recommendation_events",
                    "music_dislikeness",
                    "iot_wemo_off",
                    "cooking_recipe",
                    "qa_currency",
                    "transport_traffic",
                    "general_quirky",
                    "weather_query",
                    "audio_volume_up",
                    "email_addcontact",
                    "takeaway_order",
                    "email_querycontact",
                    "iot_hue_lightup",
                    "recommendation_locations",
                    "play_audiobook",
                    "lists_createoradd",
                    "news_query",
                    "alarm_query",
                    "iot_wemo_on",
                    "general_joke",
                    "qa_definition",
                    "social_query",
                    "music_settings",
                    "audio_volume_other",
                    "calendar_remove",
                    "iot_hue_lightdim",
                    "calendar_query",
                    "email_sendemail",
                    "iot_cleaning",
                    "audio_volume_down",
                    "play_radio",
                    "cooking_query",
                    "datetime_convert",
                    "qa_maths",
                    "iot_hue_lightoff",
                    "iot_hue_lighton",
                    "transport_query",
                    "music_likeness",
                    "email_query",
                    "play_music",
                    "audio_volume_mute",
                    "social_post",
                    "alarm_set",
                    "qa_factoid",
                    "calendar_set",
                    "play_game",
                    "alarm_remove",
                    "lists_remove",
                    "transport_taxi",
                    "recommendation_movies",
                    "iot_coffee",
                    "music_query",
                    "play_podcasts",
                    "lists_query"
                ],
                "text_type": "sentence",
                "type_of_class": "intent"
            },
            "type": "add_fields"
        }
    ],
    "task": "tasks.classification.multi_class",
    "templates": "templates.classification.multi_class.all",
    "type": "task_card"
}

Explanation about TaskCardΒΆ

TaskCard delineates the phases in transforming the source dataset into a model-input, and specifies the metrics for evaluation of model-output.

Attributes:

loader: specifies the source address and the loading operator that can access that source and transform it into a unitxt multistream.

preprocess_steps: list of unitxt operators to process the data source into a model-input.

task: specifies the fields (of the already (pre)processed instance) making the inputs, the fields making the outputs, and the metrics to be used for evaluating the model output.

templates: format strings to be applied on the input fields (specified by the task) and the output fields. The template also carries the instructions and the list of postprocessing steps, to be applied to the model output.

Explanation about RenameFieldsΒΆ

Renames fields.

Move value from one field to another, potentially, if field name contains a /, from one branch into another. Remove the from field, potentially part of it in case of / in from_field.

Examples:

RenameFields(field_to_field={β€œb”: β€œc”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œc”: 2}, {β€œa”: 2, β€œc”: 3}]

RenameFields(field_to_field={β€œb”: β€œc/d”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œc”: {β€œd”: 2}}, {β€œa”: 2, β€œc”: {β€œd”: 3}}]

RenameFields(field_to_field={β€œb”: β€œb/d”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œb”: {β€œd”: 2}}, {β€œa”: 2, β€œb”: {β€œd”: 3}}]

RenameFields(field_to_field={β€œb/c/e”: β€œb/d”}) will change inputs [{β€œa”: 1, β€œb”: {β€œc”: {β€œe”: 2, β€œf”: 20}}}] to [{β€œa”: 1, β€œb”: {β€œc”: {β€œf”: 20}, β€œd”: 2}}]

Explanation about AddFieldsΒΆ

Adds specified fields to each instance in a given stream or all streams (default) If fields exist, updates them.

Args:
fields (Dict[str, object]): The fields to add to each instance.

Use β€˜/’ to access inner fields

use_deepcopy (bool) : Deep copy the input value to avoid later modifications

Examples:

# Add a β€˜classes’ field with a value of a list β€œpositive” and β€œnegative” to all streams AddFields(fields={β€œclasses”: [β€œpositive”,”negatives”]})

# Add a β€˜start’ field under the β€˜span’ field with a value of 0 to all streams AddFields(fields={β€œspan/start”: 0}

# Add a β€˜classes’ field with a value of a list β€œpositive” and β€œnegative” to β€˜train’ stream AddFields(fields={β€œclasses”: [β€œpositive”,”negatives”], apply_to_stream=[β€œtrain”]})

# Add a β€˜classes’ field on a given list, prevent modification of original list # from changing the instance. AddFields(fields={β€œclasses”: alist}), use_deepcopy=True) # if now alist is modified, still the instances remain intact.

Explanation about MapInstanceValuesΒΆ

A class used to map instance values into other values.

This class is a type of StreamInstanceOperator, it maps values of instances in a stream using predefined mappers.

Attributes:
mappers (Dict[str, Dict[str, str]]): The mappers to use for mapping instance values.

Keys are the names of the fields to be mapped, and values are dictionaries that define the mapping from old values to new values.

strict (bool): If True, the mapping is applied strictly. That means if a value

does not exist in the mapper, it will raise a KeyError. If False, values that are not present in the mapper are kept as they are.

process_every_value (bool): If True, all fields to be mapped should be lists, and the mapping

is to be applied to their individual elements. If False, mapping is only applied to a field containing a single value.

Examples:

MapInstanceValues(mappers={β€œa”: {β€œ1”: β€œhi”, β€œ2”: β€œbye”}}) replaces β€˜1’ with β€˜hi’ and β€˜2’ with β€˜bye’ in field β€˜a’ in all instances of all streams: instance {β€œa”:”1”, β€œb”: 2} becomes {β€œa”:”hi”, β€œb”: 2}.

MapInstanceValues(mappers={β€œa”: {β€œ1”: β€œhi”, β€œ2”: β€œbye”}}, process_every_element=True) Assuming field β€˜a’ is a list of values, potentially including β€œ1”-s and β€œ2”-s, this replaces each such β€œ1” with β€œhi” and β€œ2” – with β€œbye” in all instances of all streams: instance {β€œa”: [β€œ1”, β€œ2”], β€œb”: 2} becomes {β€œa”: [β€œhi”, β€œbye”], β€œb”: 2}.

MapInstanceValues(mappers={β€œa”: {β€œ1”: β€œhi”, β€œ2”: β€œbye”}}, strict=True) To ensure that all values of field β€˜a’ are mapped in every instance, use strict=True. Input instance {β€œa”:”3”, β€œb”: 2} will raise an exception per the above call, because β€œ3” is not a key in the mapper of β€œa”.

MapInstanceValues(mappers={β€œa”: {str([1,2,3,4]): β€˜All’, str([]): β€˜None’}}, strict=True) replaces a list [1,2,3,4] with the string β€˜All’ and an empty list by string β€˜None’. Note that mapped values are defined by their string representation, so mapped values must be converted to strings.

References: templates.classification.multi_class.all, tasks.classification.multi_class

Read more about catalog usage here.