whylogs.core.model_performance_metrics.confusion_matrix#

Module Contents#

Classes#

ConfusionMatrix

Confusion Matrix Class to hold labels and matrix data.

Attributes#

whylogs.core.model_performance_metrics.confusion_matrix.MODEL_METRICS_MAX_LABELS = 256#
whylogs.core.model_performance_metrics.confusion_matrix.MODEL_METRICS_LABEL_SIZE_WARNING_THRESHOLD = 64#
whylogs.core.model_performance_metrics.confusion_matrix.EMPTY_KLL: bytes#
whylogs.core.model_performance_metrics.confusion_matrix.EMPTY_THETA: bytes#
class whylogs.core.model_performance_metrics.confusion_matrix.ConfusionMatrix(labels: Optional[List[Union[str, int, bool, float]]] = None)#

Confusion Matrix Class to hold labels and matrix data.

Parameters

labels (Optional[List[Union[str, int, bool, float]]]) –

labels#

list of labels in a sorted order

add(predictions: List[Union[str, int, bool, float]], targets: List[Union[str, int, bool, float]], scores: Optional[List[float]])#

Function adds predictions and targets to confusion matrix with scores.

Parameters
Raises
  • NotImplementedError – in case targets do not fall into binary or

  • multiclass suport

  • ValueError – incase missing validation or predictions

merge(other_cm)#

Merge two seperate confusion matrix which may or may not overlap in labels.

Parameters

other_cm (Optional[ConfusionMatrix]) – confusion_matrix to merge with self

Returns

merged confusion_matrix

Return type

ConfusionMatrix

to_protobuf() whylogs.core.proto.v0.ScoreMatrixMessage#

Convert to protobuf

Returns

Description

Return type

TYPE

classmethod from_protobuf(message: whylogs.core.proto.v0.ScoreMatrixMessage) Optional[ConfusionMatrix]#
Parameters

message (whylogs.core.proto.v0.ScoreMatrixMessage) –

Return type

Optional[ConfusionMatrix]