MCPcopy Create free account
hub / github.com/chengsen/PyTorch_TextGCN / cal_pmi

Function cal_pmi

build_graph.py:54–60  ·  view source on GitHub ↗
(W_ij, W, word_freq_1, word_freq_2)

Source from the content-addressed store, hash-verified

52
53
54def cal_pmi(W_ij, W, word_freq_1, word_freq_2):
55 p_i = word_freq_1 / W
56 p_j = word_freq_2 / W
57 p_i_j = W_ij / W
58 pmi = math.log(p_i_j / (p_i * p_j))
59
60 return pmi
61
62
63def count_pmi(windows_len, word_pair_count, word_window_freq, threshold):

Callers 1

count_pmiFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected