-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gensim models show_topic/print_topic parameter num_words changed to topn to match other topic models #1200
Merged
Merged
gensim models show_topic/print_topic parameter num_words changed to topn to match other topic models #1200
Changes from 33 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
1c63c9a
Merge branch 'release-0.12.3rc1'
tmylk 280a488
Merge branch 'release-0.12.3'
tmylk ddeb002
Merge branch 'release-0.12.3'
tmylk f2ac3a9
Update CHANGELOG.txt
tmylk cf09e8c
Update CHANGELOG.txt
tmylk b61287a
resolve merge conflict in Changelog
tmylk 3ade404
Merge branch 'release-0.12.4' with #596
tmylk 9e6522e
Merge branch 'release-0.13.0'
tmylk 87c4e9c
Merge branch 'release-0.13.0'
tmylk 9c74b40
Release version typo fix
tmylk 7b30025
Merge branch 'release-0.13.0rc1'
tmylk de79c8e
Merge branch 'release-0.13.0'
tmylk d4f9cc5
Merge branch 'release-0.13.1'
tmylk d8e9c0f
Merge branch 'release-0.13.2'
tmylk 7c118fc
Merge branch 'release-0.13.2'
tmylk 432f840
Merge branch 'release-0.13.3'
tmylk b42e181
Merge branch 'release-0.13.3'
tmylk 3067cb0
Win and OSX build fix
tmylk e838391
Merge branch 'release-0.13.4'
tmylk 5d47ec4
Merge branch 'release-0.13.4.1'
tmylk a18de8d
Merge branch 'release-1.0.0rc1'
tmylk 67b1a17
Typo in version
tmylk df13670
Fix merge conflict
tmylk 78da89a
Merge branch 'release-1.0.0'
tmylk fb3f303
Merge branch 'release-1.0.1'
tmylk adc447d
Merge branch 'release-1.0.1'
tmylk 333fd4d
Merge branch 'release-1.0.1'
tmylk 61dc832
show_topic parameter num_words changed to topn
prakhar2b 5f71f66
hdpmodel topn/num_words conflict resolved
prakhar2b b3d210c
dtmmodel topn/show_topic conflict resolved
prakhar2b c7f9824
ldamallet topn/num_words conflict resolved
prakhar2b 42ac76d
whitespace error resolved
prakhar2b 113a0af
whitespace error resolved
prakhar2b 51683f1
split multi-line comments in hdpmodel
prakhar2b 29ab15f
splitting multi-line comments in dtmmodel
prakhar2b f949ce6
splitting multi-line comments for ldamallet
prakhar2b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,12 +240,17 @@ def show_topics(self, num_topics=10, num_words=10, log=False, formatted=True): | |
logger.info("topic #%i (%.3f): %s", i, self.alpha[i], topic) | ||
return shown | ||
|
||
def show_topic(self, topicid, num_words=10): | ||
def show_topic(self, topicid, topn=10, num_words=None): | ||
if num_words is not None: # deprecated num_words is used | ||
logger.warn("The parameter num_words for show_topic() method would be deprecated in the updated version.\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dtto. |
||
Please use topn instead.") | ||
topn = num_words | ||
|
||
if self.word_topics is None: | ||
logger.warn("Run train or load_word_topics before showing topics.") | ||
topic = self.word_topics[topicid] | ||
topic = topic / topic.sum() # normalize to probability dist | ||
bestn = matutils.argsort(topic, num_words, reverse=True) | ||
bestn = matutils.argsort(topic, topn, reverse=True) | ||
beststr = [(self.id2word[id], topic[id]) for id in bestn] | ||
return beststr | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would include the whitespace after
\
in the mesage.It's better to split multi-line strings using
"abc" "dce"
(two strings next to each other, on different lines).