alibi.models.pytorch.metrics module
This module contains a loss wrapper and a definition of various monitoring metrics used during training. The model
to be trained inherits form alibi.explainers.models.pytorch.model.Model
and represents a simplified
version of the tensorflow.keras API for training and monitoring the model. Currently it is used internally to test
the functionalities for the Pytorch backend. To be discussed if the module will be exposed to the user in future
versions.
- class alibi.models.pytorch.metrics.AccuracyMetric(name='accuracy')[source]
Bases:
Metric
Accuracy monitoring metric.
- class alibi.models.pytorch.metrics.LossContainer(loss, name)[source]
Bases:
object
Loss wrapped to monitor the average loss throughout training.
- __call__(y_pred, y_true)[source]
Computes and accumulates the loss given the prediction labels and the true labels.
- Parameters:
y_pred (
Tensor
) – Prediction labels.y_true (
Tensor
) – True labels.
- Return type:
Tensor
- Returns:
Loss value.
- class alibi.models.pytorch.metrics.Metric(reduction=Reduction.MEAN, name='unknown')[source]
Bases:
ABC
Monitoring metric object. Supports two types of reduction: mean and sum.