๐ With Classes Descriptionsยถ
This is a special case of multi class text classification task, in which we classify a given text to a set of topics. The only difference from โtasks.classification.multi_classโ, is that the addition of โclasses_descriptionsโ field, which is used by the template to add a description for each class.
tasks.classification.multi_class.with_classes_descriptions
Task(
input_fields={
"text": "str",
"text_type": "str",
"classes": "List[str]",
"type_of_class": "str",
"classes_descriptions": "str",
},
reference_fields={
"label": "str",
},
prediction_type="str",
metrics=[
"metrics.f1_micro",
"metrics.accuracy",
"metrics.f1_macro",
],
augmentable_inputs=[
"text",
],
defaults={
"text_type": "text",
"type_of_class": "class",
},
)
[source]Explanation about Taskยถ
Task packs the different instance fields into dictionaries by their roles in the task.
- Args:
- input_fields (Union[Dict[str, str], List[str]]):
Dictionary with string names of instance input fields and types of respective values. In case a list is passed, each type will be assumed to be Any.
- reference_fields (Union[Dict[str, str], List[str]]):
Dictionary with string names of instance output fields and types of respective values. In case a list is passed, each type will be assumed to be Any.
- metrics (List[str]):
List of names of metrics to be used in the task.
- prediction_type (Optional[str]):
Need to be consistent with all used metrics. Defaults to None, which means that it will be set to Any.
- defaults (Optional[Dict[str, Any]]):
An optional dictionary with default values for chosen input/output keys. Needs to be consistent with names and types provided in โinput_fieldsโ and/or โoutput_fieldsโ arguments. Will not overwrite values if already provided in a given instance.
- The output instance contains three fields:
โinput_fieldsโ whose value is a sub-dictionary of the input instance, consisting of all the fields listed in Arg โinput_fieldsโ.
โreference_fieldsโ โ for the fields listed in Arg โreference_fieldsโ.
โmetricsโ โ to contain the value of Arg โmetricsโ
References: metrics.f1_micro, metrics.f1_macro, metrics.accuracy
Read more about catalog usage here.