π spearmanΒΆ
Note
ID: metrics.spearman | Type: MetricPipeline
{
"main_score": "spearmanr",
"metric": {
"type": "spearmanr"
},
"preprocess_steps": [
{
"field_to_field": [
[
"references/0",
"references"
]
],
"type": "copy_fields"
},
{
"failure_defaults": {
"prediction": 0.0
},
"fields": {
"prediction": "float",
"references": "float"
},
"type": "cast_fields",
"use_nested_query": true
}
],
"type": "metric_pipeline"
}
Explanation about CastFieldsΒΆ
Casts specified fields to specified types.
- Args:
use_nested_query (bool): Whether to cast nested fields, expressed in dpath. Defaults to False. fields (Dict[str, str]): A dictionary mapping field names to the names of the types to cast the fields to.
e.g: βintβ, βstrβ, βfloatβ, βboolβ. Basic names of types
defaults (Dict[str, object]): A dictionary mapping field names to default values for cases of casting failure. process_every_value (bool): If true, all fields involved must contain lists, and each value in the list is then casted. Defaults to False.
- Examples:
- CastFields(
fields={βa/dβ: βfloatβ, βbβ: βintβ}, failure_defaults={βa/dβ: 0.0, βbβ: 0}, process_every_value=True, use_nested_query=True
)
- would process the input instance: {βaβ: {βdβ: [βhalfβ, β0.6β, 1, 12]}, βbβ: [β2β]}
into {βaβ: {βdβ: [0.0, 0.6, 1.0, 12.0]}, βbβ: [2]}
Explanation about CopyFieldsΒΆ
Copies values from specified fields to specified fields.
- Args (of parent class):
field_to_field (Union[List[List], Dict[str, str]]): A list of lists, where each sublist contains the source field and the destination field, or a dictionary mapping source fields to destination fields.
- Examples:
An input instance {βaβ: 2, βbβ: 3}, when processed by CopyField(field_to_field={βaβ: βbβ} would yield {βaβ: 2, βbβ: 2}, and when processed by CopyField(field_to_field={βaβ: βcβ} would yield {βaβ: 2, βbβ: 3, βcβ: 2}
with field names containing / , we can also copy inside the field: CopyFields(field_to_field={βa/0β: βaβ}) would process instance {βaβ: [1, 3]} into {βaβ: 1}
Read more about catalog usage here.