-
-
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
Fix docstrings for gensim.models.rpmodel
#1802
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
453e5b4
first attempt to convert few lines into numpy-style doc
79c71ba
added parameters in documentation
4d748a6
more documentation
00adee9
few corrections
eecb40a
show inheritance and undoc members
9d16880
show special members
0c389bb
example is executable now
7e13ad8
link to the paper added, named parameters
0832837
fixed doc
fcfe828
fixed doc
fb3e133
fixed whitespaces
8132f51
fix docstrings & PEP8
menshikh-iv a4b332c
fix docstrings
menshikh-iv e9a1a24
fix typo
menshikh-iv 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
Objects of this class allow building and maintaining a model for Random Projections | ||
(also known as Random Indexing). | ||
|
||
For theoretical background on RP, see: Kanerva et al.: "Random indexing of text samples for Latent Semantic Analysis." | ||
For theoretical background on RP, see [1]_. | ||
: Kanerva et al.: "Random indexing of text samples for Latent Semantic Analysis." | ||
|
||
The main methods are: | ||
|
||
|
@@ -31,6 +32,10 @@ | |
>>> some_doc = dictionary.doc2bow(common_texts[0]) | ||
>>> print(rp[some_doc]) | ||
>>> rp.save('/tmp/foo.rp_model') | ||
|
||
|
||
.. [1] Kanerva et al., 2000, Random indexing of text samples for Latent Semantic Analysis, https://cloudfront.escholarship.org/dist/prd/content/qt5644k0w6/qt5644k0w6.pdf | ||
|
||
""" | ||
|
||
import logging | ||
|
@@ -55,8 +60,13 @@ def __init__(self, corpus, id2word=None, num_topics=300): | |
Parameters | ||
---------- | ||
corpus : :class:`~gensim.interfaces.CorpusABC` | ||
Iterable of documents | ||
|
||
id2word : dict of (int, string) | ||
Mapping from word ids (integers) to words (strings) | ||
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. Redundant type definition |
||
|
||
num_topics : int | ||
Number of topics | ||
|
||
""" | ||
self.id2word = id2word | ||
|
@@ -75,6 +85,7 @@ def initialize(self, corpus): | |
Parameters | ||
---------- | ||
corpus : :class:`~interfaces.CorpusABC` | ||
Iterable of documents | ||
|
||
""" | ||
if self.id2word is None: | ||
|
@@ -103,6 +114,7 @@ def __getitem__(self, bow): | |
Parameters | ||
---------- | ||
bow : :class:`~interfaces.CorpusABC` (iterable of documents) or list of (int, int). | ||
Input document | ||
|
||
Examples: | ||
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. Redundant |
||
------------- | ||
|
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.
Better to add example here (sometimes code tell us more than text)