πŸ“„ 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.