    def get_metric(self, reset: bool = False):
        """
        # Returns

        The accumulated sample Pearson correlation.
        """
        if is_distributed():
            raise RuntimeError(
                "Distributed aggregation for PearsonCorrelation is currently not supported."
            )
        covariance = self._predictions_labels_covariance.get_metric(reset=reset)
        predictions_variance = self._predictions_variance.get_metric(reset=reset)
        labels_variance = self._labels_variance.get_metric(reset=reset)
        denominator = math.sqrt(predictions_variance) * math.sqrt(labels_variance)
        if reset:
            self.reset()

        if np.around(denominator, decimals=5) == 0:
            pearson_r = 0.0
        else:
            pearson_r = covariance / denominator
        return pearson_r
# Returns

The accumulated sample Pearson correlation.
allennlp/training/metrics/pearson_correlation.py