e9a7706e526d604042f662b15e8963eaecfa6c98,gplearn/genetic.py,,weighted_pearson,#Any#Any#Any#,73
Before Change
Calculate the weighted Pearson correlation coefficient.
x1_demean = x1 - np.average(x1, weights=w)
x2_demean = x2 - np.average(x2, weights=w)
return ((np.sum(w * x1_demean * x2_demean) / np.sum(w)) /
np.sqrt((np.sum(w * x1_demean ** 2) * np.sum(w * x2_demean ** 2)) /
(np.sum(w) ** 2)))
def weighted_spearman(x1, x2, w):
Calculate the weighted Spearman correlation coefficient.
After Change
old_settings = np.seterr(divide="ignore", invalid="ignore")
x1_demean = x1 - np.average(x1, weights=w)
x2_demean = x2 - np.average(x2, weights=w)
corr = ((np.sum(w * x1_demean * x2_demean) / np.sum(w)) /
np.sqrt((np.sum(w * x1_demean ** 2) * np.sum(w * x2_demean ** 2)) /
(np.sum(w) ** 2)))
np.seterr(**old_settings)
if np.isfinite(corr):
return np.abs(corr)
return 0
def weighted_spearman(x1, x2, w):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: trevorstephens/gplearn
Commit Name: e9a7706e526d604042f662b15e8963eaecfa6c98
Time: 2015-04-18
Author: trev.stephens@gmail.com
File Name: gplearn/genetic.py
Class Name:
Method Name: weighted_pearson
Project Name: Calamari-OCR/calamari
Commit Name: f5347c435e5d1b39af2fd8e18e8416a56d42802c
Time: 2018-07-05
Author: wick.chr.info@gmail.com
File Name: calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_model.py
Class Name: TensorflowModel
Method Name: train_batch
Project Name: hyperopt/hyperopt
Commit Name: 601766924f5892858752758b8ffa6fe627f99d61
Time: 2014-01-30
Author: james.bergstra@gmail.com
File Name: hyperopt/criteria.py
Class Name:
Method Name: logEI_gaussian
Project Name: Calamari-OCR/calamari
Commit Name: f5347c435e5d1b39af2fd8e18e8416a56d42802c
Time: 2018-07-05
Author: wick.chr.info@gmail.com
File Name: calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_model.py
Class Name: TensorflowModel
Method Name: train_dataset