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

[MRG] FastText out-of-vocab fix #1409

Merged
merged 7 commits into from
Jun 13, 2017
Merged

Conversation

jayantj
Copy link
Contributor

@jayantj jayantj commented Jun 12, 2017

  1. Cleans up some old tests for FastText wrapper
  2. Adds (initially failing) tests for ensuring vectors for out-of-vocab words are as expected.
  3. Fixes in FastText wrapper with correct out-of-vocab word handling.

@menshikh-iv @prakhar2b Please review.

@prakhar2b
Copy link
Contributor

@jayantj That's great. Thanks 😄
I'll update PR #1341 accordingly now.

@@ -344,7 +344,7 @@ def init_ngrams(self):
ngram_indices = []
for i, ngram in enumerate(all_ngrams):
ngram_hash = self.ft_hash(ngram)
ngram_indices.append((len(self.wv.vocab) + ngram_hash) % self.bucket)
ngram_indices.append((len(self.wv.vocab)) + ngram_hash % self.bucket)
Copy link
Contributor

Choose a reason for hiding this comment

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

No needed brackets (len(...))
Also, you change operation order, it's correct behavior?

Copy link
Contributor Author

@jayantj jayantj Jun 13, 2017

Choose a reason for hiding this comment

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

Removed the extra brackets.
Yes, the new operation order is correct behaviour, it was a bug earlier.

@menshikh-iv
Copy link
Contributor

Nice work @jayantj 👍

@menshikh-iv menshikh-iv merged commit fe3dc53 into piskvorky:develop Jun 13, 2017
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.

3 participants