Skip to content

Commit

Permalink
Fix parameters in score_cbow_pair (#1468)
Browse files Browse the repository at this point in the history
* remove unused argument from score_cbow_pair
  • Loading branch information
Jack Hessel authored and menshikh-iv committed Jul 6, 2017
1 parent 9d3b724 commit 7115c72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gensim/models/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def score_sentence_cbow(model, sentence, work=None, neu1=None):
l1 = np_sum(model.wv.syn0[word2_indices], axis=0) # 1 x layer1_size
if word2_indices and model.cbow_mean:
l1 /= len(word2_indices)
log_prob_sentence += score_cbow_pair(model, word, word2_indices, l1)
log_prob_sentence += score_cbow_pair(model, word, l1)

return log_prob_sentence

Expand Down Expand Up @@ -365,7 +365,7 @@ def score_sg_pair(model, word, word2):
return sum(lprob)


def score_cbow_pair(model, word, word2_indices, l1):
def score_cbow_pair(model, word, l1):
l2a = model.syn1[word.point] # 2d matrix, codelen x layer1_size
sgn = (-1.0)**word.code # ch function, 0-> 1, 1 -> -1
lprob = -logaddexp(0, -sgn * dot(l1, l2a.T))
Expand Down

0 comments on commit 7115c72

Please # to comment.