MCPcopy Create free account
hub / github.com/OpenDCAI/DataFlow-MM / compute_correlation_uniquehuman

Function compute_correlation_uniquehuman

dataflow/utils/utils.py:52–75  ·  view source on GitHub ↗
(pred, all_human_scores)

Source from the content-addressed store, hash-verified

50 return None
51
52def compute_correlation_uniquehuman(pred, all_human_scores):
53 num_workers = 3
54 import scipy.stats
55
56 pred = np.around(pred, decimals=4)
57
58 spearman = 0
59 for worker_i in range(num_workers):
60 tmp, p_value = scipy.stats.spearmanr(pred, all_human_scores[:, worker_i])
61 assert p_value < 0.01
62 spearman += tmp
63 spearman /= num_workers
64 spearman = np.around(spearman, decimals=4)
65
66 kendalltau = 0
67 for worker_i in range(num_workers):
68 tmp, p_value = scipy.stats.kendalltau(pred, all_human_scores[:, worker_i])
69 assert p_value < 0.01
70 kendalltau += tmp
71 kendalltau /= num_workers
72 kendalltau = np.around(kendalltau, decimals=4)
73
74 print('kendall: {}, spear: {}'.format(kendalltau, spearman))
75 return kendalltau, spearman
76
77
78def normalize_matrix(A):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected