Skip to content
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

Add build_vocab to poincare model #2505

Merged
merged 18 commits into from
Jul 7, 2019
Merged

Add build_vocab to poincare model #2505

merged 18 commits into from
Jul 7, 2019

Conversation

koiizukag
Copy link
Contributor

@koiizukag koiizukag commented May 29, 2019

This PR makes the following changes: to fix #2514

  • Add build_vocab to poincare model for online learning.
  • add unit test.

@koiizukag
Copy link
Contributor Author

Add issue #2514 😃

@koiizukag
Copy link
Contributor Author

@piskvorky Hi, please assign some reviewer

@piskvorky
Copy link
Owner

piskvorky commented Jun 3, 2019

We're busy finishing up a large "Gensim docs" project, but @mpenkov will get to your PR eventually. Thanks for your patience @koiizukag.

@mpenkov mpenkov self-assigned this Jun 21, 2019
Copy link
Collaborator

@mpenkov mpenkov left a comment

Choose a reason for hiding this comment

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

Thank you for your patience. Your changes look good overall, but I left you some minor comments.

gensim/models/poincare.py Show resolved Hide resolved

def _load_relations(self):
def build_vocab(self, relations=None, update=False):
Copy link
Collaborator

Choose a reason for hiding this comment

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

You've made this a public method, so it needs a good docstring. Please look at other docstrings in the code for examples on how to write a good one.

gensim/models/poincare.py Show resolved Hide resolved
add doc
…kag/gensim into add-build_vocab-to-poincare_model
relations : list of tuples
List of tuples of positive examples of the form (node_1_index, node_2_index).
update : bool
If true, the new nodes in `relations` will be added to model's vocab.
Copy link
Owner

Choose a reason for hiding this comment

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

But relations doesn't contain nodes. Its description above says it contains "node indexes" (btw where does the user find those?).

Also, what happens if False (the default)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified the description of relations using init description.

But relations doesn't contain nodes. Its description above says it contains "node indexes" (btw where does the user find those?).

If update=False, the embeddings are initialized by random values.
(It means that the trained embeddings are cleaned.)

Also, what happens if False (the default)?

Copy link
Owner

Choose a reason for hiding this comment

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

OK, I don't really understand that, but that information should appear in the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added update=False description in build_vocab 👍

Copy link
Collaborator

@mpenkov mpenkov left a comment

Choose a reason for hiding this comment

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

Very good. I'm going to suggest some very minor corrections for clarity. Please have a look and apply them if they make sense.

gensim/models/poincare.py Outdated Show resolved Hide resolved
gensim/models/poincare.py Outdated Show resolved Hide resolved
gensim/models/poincare.py Outdated Show resolved Hide resolved
gensim/models/poincare.py Show resolved Hide resolved
gensim/models/poincare.py Outdated Show resolved Hide resolved
gensim/models/poincare.py Outdated Show resolved Hide resolved
gensim/models/poincare.py Outdated Show resolved Hide resolved
koiizukag and others added 7 commits June 26, 2019 14:19
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
@koiizukag
Copy link
Contributor Author

Thanks for your modification. LGTM

minor update
@koiizukag
Copy link
Contributor Author

@mpenkov Is there anything to be done next❓

@koiizukag
Copy link
Contributor Author

@piskvorky I think this PR is ready to merge. Please check here 🙏

@piskvorky
Copy link
Owner

piskvorky commented Jul 1, 2019

@mpenkov will be with you shortly, we have a lot going on. Thanks for your patience.

@mpenkov mpenkov merged commit e776e44 into piskvorky:develop Jul 7, 2019
@mpenkov
Copy link
Collaborator

mpenkov commented Jul 7, 2019

Merged. @koiizukag Congratulations on your first contribution to gensim 🥇 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Threre is no support for online learning in poincare model
3 participants