Skip to content

LSI documentation#1892

Merged
menshikh-iv merged 20 commits into
piskvorky:developfrom
steremma:lsi-docs
Feb 16, 2018
Merged

LSI documentation#1892
menshikh-iv merged 20 commits into
piskvorky:developfrom
steremma:lsi-docs

Conversation

@steremma
Copy link
Copy Markdown
Contributor

@steremma steremma commented Feb 9, 2018

In this PR I attempt to fix the source internal documentation for the LSI model. More specifically:

  • Numpy docstrings for functions methods and classes

  • Including type annotation for arguments and returned objects

Copy link
Copy Markdown
Contributor

@menshikh-iv menshikh-iv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall - looks great! Please make several fixes & annotate lsi_distributed.py file too.

Comment thread gensim/models/lsimodel.py Outdated

def asfarray(a, name=''):
"""
Return an array laid out in Fortran order in memory.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"""Some word instead of

"""
Some word
...

Comment thread gensim/models/lsimodel.py Outdated

Returns
-------
out : ndarray
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numpy.ndarray + we have no "out" parameter here (only a), this is enough to mention the only type (here and everywhere).

Comment thread gensim/models/lsimodel.py
"""
Construct the (U, S) projection from a corpus `docs`. The projection can
be later updated by merging it with another Projection via `self.merge()`.
"""Construct the (U, S) projection from a corpus.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to move this description to class docstring (instead of __init__), here and everywhere.

Comment thread gensim/models/lsimodel.py Outdated

Returns
-------
Projection
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use links in sphinx manner, like

:class:`~gensim.models.lsimodel.Projection`

for all "gensim types" (i.e. defined in gensim), here and everywhere.

* General class level remarks moved to class docstring from `__init__`

* References to `gensim` classes are now using `sphinx` notation.

* Numpy parameters annotated with `np.type` instead of `type`.
Comment thread gensim/models/lsi_dispatcher.py Outdated

"""
USAGE: %(program)s SIZE_OF_JOBS_QUEUE
Dispatcher process which orchestrates distributed LSI computations. Run this
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is executable script, some "special case", please look into __doc__ and .. program-output from 117d447 (same for lsi_worker)

@menshikh-iv menshikh-iv added the incubator project PR is RaRe incubator project label Feb 16, 2018
@menshikh-iv menshikh-iv merged commit 0db8796 into piskvorky:develop Feb 16, 2018
@menshikh-iv
Copy link
Copy Markdown
Contributor

Goond job @steremma 🔥

sj29-innovate pushed a commit to sj29-innovate/gensim that referenced this pull request Feb 21, 2018
* Added numpy style docstrings to all functions, methods and classes in the LsiModel module. Types need to be checked before merging

* Fixed generic container type (stream/list -> iterable) and added expected shape for sparse matrix arguments

* Fix PEP-8

* Applied corrections mentioned in code review.

* General class level remarks moved to class docstring from `__init__`

* References to `gensim` classes are now using `sphinx` notation.

* Numpy parameters annotated with `np.type` instead of `type`.

* Added docstrings for `lsi_worker` and `lsi_dispatcher`

* added argument parsing and fixed __doc__

* update configs with new extension sphinxcontrib.programoutput

* added blank link in __doc__

* sphinx identation fix

* chmod revert

* fix lsimodel[1]

* fix lsimodel[2]

* fix lsimodel[3]

* fix lsimodel[4]

* fix basemodel

* fixes

* fix lsi_worker & missing fields in .rst

* last fixes for worker & dispatcher

* add missing link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

incubator project PR is RaRe incubator project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants