arthurai.explainability.validation.validate_predicted_attribute_order_matches_dataframe#

arthurai.explainability.validation.validate_predicted_attribute_order_matches_dataframe(actual_preds, sample_data, predicted_attributes)#

Helper function to check that the order of the predicted attributes matches the output from the user predict() function.

A common failure case is a user registering a binary classifier with a single positive predicted attribute, but returning the value of predict_proba() from their classifier. The result is that the implicit negative column is registered as the second column (<pos_proba>, <neg_proba>) but SkLearn and most other libraries output with the negative prediction in the first column (<neg_proba>, <pos_proba>).

Parameters
  • actual_preds (ndarray) – predictions pulled from the user’s predict() function

  • sample_data (DataFrame) – a DataFrame containing user-provided predictions

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

Returns

None

Raises

UserValueError – if the prediction order doesn’t match or it cannot be determined