alibi.explainers.backends.cfrl_base module
This module contains utility functions for the Counterfactual with Reinforcement Learning base class,
alibi.explainers.cfrl_base
, that are common for both Tensorflow and Pytorch backends.
- class alibi.explainers.backends.cfrl_base.CounterfactualRLDataset[source]
Bases:
ABC
- alibi.explainers.backends.cfrl_base.get_classification_reward(Y_pred, Y_true)[source]
Computes classification reward per instance given the prediction output and the true label. The classification reward is a sparse/binary reward: 1 if the most likely classes from the prediction output and the label match, 0 otherwise.
- Parameters:
Y_pred (
ndarray
) – Prediction output as a distribution over the possible classes.Y_true (
ndarray
) – True label as a distribution over the possible classes.
- Returns:
Classification reward per instance. 1 if the most likely classes match, 0 otherwise.