87a61ad92a9e0129e5c81c242f0ea96d77e6b0af,allennlp/training/metrics/pearson_correlation.py,PearsonCorrelation,get_metric,#PearsonCorrelation#Any#,71
Before Change
// Note: this gives an approximate aggregation of the covariance.
device = self._device
_covariance = torch.tensor(covariance).to(device)
dist.all_reduce(_covariance, op=dist.ReduceOp.SUM)
covariance = _covariance.item()
_denominator = torch.tensor(denominator).to(device)
After Change
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)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: allenai/allennlp
Commit Name: 87a61ad92a9e0129e5c81c242f0ea96d77e6b0af
Time: 2020-08-19
Author: akshita23bhagia@gmail.com
File Name: allennlp/training/metrics/pearson_correlation.py
Class Name: PearsonCorrelation
Method Name: get_metric
Project Name: cornellius-gp/gpytorch
Commit Name: d44475866914c19f23c0f8a833951f9989250334
Time: 2018-11-17
Author: balandat@fb.com
File Name: gpytorch/kernels/kernel.py
Class Name: Kernel
Method Name: __init__
Project Name: facebookresearch/pytext
Commit Name: dcb8fcffb070fd393cb690eff83683de7b4ccedc
Time: 2020-03-17
Author: chenyangyu@fb.com
File Name: pytext/torchscript/module.py
Class Name: ScriptPyTextEmbeddingModuleWithDense
Method Name: forward