    def get_metric(self, reset: bool = False) -> Dict[int, torch.FloatTensor]:
        """
        # Returns

        distances : `Dict[int, torch.FloatTensor]`
            A dictionary mapping each protected variable label a to the KL divergence or Wasserstein distance
             of P(C | A = a) from P(C). A distance of nearly 0 implies fairness on the basis of Independence.
        """
        distances: Dict[int, torch.FloatTensor] = {}
        if self._total_predictions == 0:
            distances = {
                a: torch.tensor(float("nan")) for a in range(self._num_protected_variable_labels)
            }
            return distances

        C_dist = Categorical(self._predicted_label_counts / self._total_predictions)
        if self._dist_metric == wasserstein_distance:
            C_dist = C_dist.probs
        for a in range(self._num_protected_variable_labels):
            C_given_a_dist = Categorical(
                self._predicted_label_counts_by_protected_variable_label[a]
                / self._total_predictions
            )
            if self._dist_metric == kl_divergence:
                distances[a] = self._dist_metric(C_given_a_dist, C_dist)
            elif self._dist_metric == wasserstein_distance:
                C_given_a_dist = C_given_a_dist.probs
                # scipy expects empirical values as well as probabilities
                label_values = torch.tensor(range(self._num_classes))
                distances[a] = self._dist_metric(label_values, label_values, C_given_a_dist, C_dist)
        if reset:
            self.reset()
        return distances
# Returns

distances : `Dict[int, torch.FloatTensor]`
A dictionary mapping each protected variable label a to the KL divergence or Wasserstein distance
of P(C | A = a) from P(C). A distance of nearly 0 implies fairness on the basis of Independence.
allennlp/fairness/fairness_metrics.py