d58f6cb01803f255f8d42c740bc399d083db4640,python/mxnet/metric.py,PearsonCorrelation,update,#PearsonCorrelation#Any#Any#,1449
Before Change
check_label_shapes(label, pred, False, True)
label = label.asnumpy()
pred = pred.asnumpy()
pearson_corr = numpy.corrcoef(pred.ravel(), label.ravel())[0, 1]
self.sum_metric += pearson_corr
self.global_sum_metric += pearson_corr
self.num_inst += 1
After Change
for label, pred in zip(labels, preds):
check_label_shapes(label, pred, False, True)
label = label.asnumpy().ravel().astype(numpy.float64)
pred = pred.asnumpy().ravel().astype(numpy.float64)
if self.average == "macro":
pearson_corr = numpy.corrcoef(pred, label)[0, 1]
self.sum_metric += pearson_corr
self.global_sum_metric += pearson_corr
self.num_inst += 1
self.global_num_inst += 1
else:
self.global_num_inst += 1
self.num_inst += 1
self._label_nums, self._mean_l, self._sse_l = \
self.update_variance(label, self._label_nums, self._mean_l, self._sse_l)
self.update_cov(label, pred)
self._pred_nums, self._mean_p, self._sse_p = \
self.update_variance(pred, self._pred_nums, self._mean_p, self._sse_p)
def get(self):
if self.num_inst == 0:
return (self.name, float("nan"))
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: apache/incubator-mxnet
Commit Name: d58f6cb01803f255f8d42c740bc399d083db4640
Time: 2019-12-08
Author: 798672141@qq.com
File Name: python/mxnet/metric.py
Class Name: PearsonCorrelation
Method Name: update
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_pooled_ols.py
Class Name:
Method Name: test_two_way_clustering
Project Name: AIRLab-POLIMI/mushroom
Commit Name: c24348fe44025c97a7cf7a680b35dfbee3993bf1
Time: 2017-06-08
Author: carlo.deramo@gmail.com
File Name: PyPi/utils/parameters.py
Class Name: Parameter
Method Name: __call__
Project Name: NervanaSystems/coach
Commit Name: 0a712ecc9491493efb5169474ffac2a1ff266609
Time: 2019-10-06
Author: shadi.endrawis@intel.com
File Name: rl_coach/utilities/shared_running_stats.py
Class Name: NumpySharedRunningStats
Method Name: push_val