whylogs.core.metrics.model_metrics

Module Contents

Classes

ModelMetrics

Container class for various model-related metrics

class whylogs.core.metrics.model_metrics.ModelMetrics(confusion_matrix: whylogs.core.metrics.confusion_matrix.ConfusionMatrix = None, regression_metrics: whylogs.core.metrics.regression_metrics.RegressionMetrics = None, nlp_metrics: whylogs.core.metrics.nlp_metrics.NLPMetrics = None, model_type: whylogs.proto.ModelType = ModelType.UNKNOWN)

Container class for various model-related metrics

confusion_matrix

ConfusionMatrix which keeps it track of counts with NumberTracker

Type

ConfusionMatrix

regression_metrics

Regression Metrics keeps track of a common regression metrics in case the targets are continous.

Type

RegressionMetrics

to_protobuf(self) whylogs.proto.ModelMetricsMessage
classmethod from_protobuf(cls, message)
init_or_get_model_type(self, scores) whylogs.proto.ModelType
compute_confusion_matrix(self, predictions: List[Union[str, int, bool, float]], targets: List[Union[str, int, bool, float]], scores: List[float] = None, target_field: str = None, prediction_field: str = None, score_field: str = None)

computes the confusion_matrix, if one is already present merges to old one.

Parameters
  • predictions (List[Union[str, int, bool]]) –

  • targets (List[Union[str, int, bool]]) –

  • scores (List[float], optional) –

  • target_field (str, optional) –

  • prediction_field (str, optional) –

  • score_field (str, optional) –

compute_regression_metrics(self, predictions: List[Union[float, int]], targets: List[Union[float, int]], target_field: str = None, prediction_field: str = None)
merge(self, other)