Skip to content

Commit

Permalink
Fix positional params used for gensim.models.CoherenceModel in `gen…
Browse files Browse the repository at this point in the history
…sim.models.callbacks` (piskvorky#1823)

* add keyword params for call to gensim.models.CoherenceModel as positional arguments for coherence and topn were incorrect due to skipping param for keyed_vectors

* Fix PEP8
  • Loading branch information
Alexjmsherman authored and sj29-innovate committed Feb 21, 2018
1 parent 33a88f4 commit 36a16bf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gensim/models/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,13 @@ def get_value(self, **kwargs):
self.model = None
self.topics = None
super(CoherenceMetric, self).set_parameters(**kwargs)

cm = gensim.models.CoherenceModel(
self.model, self.topics, self.texts, self.corpus, self.dictionary,
self.window_size, self.coherence, self.topn
model=self.model, topics=self.topics, texts=self.texts, corpus=self.corpus,
dictionary=self.dictionary, window_size=self.window_size,
coherence=self.coherence, topn=self.topn
)

return cm.get_coherence()


Expand Down

0 comments on commit 36a16bf

Please sign in to comment.