arthurai.core.inferences.nest_inference_and_ground_truth_data#

arthurai.core.inferences.nest_inference_and_ground_truth_data(data, attributes)#

Reformat List of Dicts inference data to nest inference and ground truth data as expected by the Arthur API. For example:

[
    {
        "input_attr_1": 1.0,
        "prediction_1": 0.95,
        "inference_timestamp": "2021-06-03T19:44:33.169334+00:00",
        "ground_truth_1": 1,
        "ground_truth_timestamp": "2021-06-03T19:44:56.892019+00:00"
    }
]

Will become:

[
    {
        "inference_data":
        {
            "input_attr_1": 1.0,
            "prediction_1": 0.95
        },
        "ground_truth_data":
        {
            "ground_truth_1": 1
        },
        "inference_timestamp": "2021-06-03T19:44:33.169334+00:00",
        "ground_truth_timestamp": "2021-06-03T19:44:56.892019+00:00"
    }
]
Parameters
  • data (List[Dict[str, Any]]) – the input data to reformat, either already nested or flat

  • attributes (List[ArthurAttribute]) – the model’s attributes

Return type

List[Dict[str, Any]]

Returns

the nested data