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] Poincare Model implementation #1696

Merged
merged 116 commits into from
Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from 105 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
6afdd22
Initial classes and loading data for poincare model
jayantj Oct 23, 2017
a804006
Initial implementation of training using autograd
jayantj Oct 23, 2017
6bd0d4b
faster negative sampling, bugfix in vector updates
jayantj Oct 25, 2017
98f94a7
allows poincare dist function to be differentiable by autograd
jayantj Oct 25, 2017
b727523
batched gradient descent initial implementation
jayantj Oct 25, 2017
1e6aee1
minor changes to batch poincare distance computation
jayantj Oct 25, 2017
e286a0b
Adds calculation of gradients for poincare model
jayantj Oct 26, 2017
3e28e8b
Correct implementation of clipping of updated vectors
jayantj Oct 26, 2017
99a2270
Fixes error in gradient computation
jayantj Oct 26, 2017
2e9e31c
Better messages while training
jayantj Oct 26, 2017
d72cb10
Renames PoincareDistance to PoincareExample for clarity
jayantj Oct 27, 2017
d439501
Compares computed gradients to autograd gradients every few iterations
jayantj Oct 27, 2017
e1ed24d
Avoids doing some numpy computations twice
jayantj Oct 27, 2017
3b2a383
Avoids creating copies of numpy vectors
jayantj Oct 27, 2017
7d68aae
Only calls nan_to_num when gamma has at least one value equal to 1
jayantj Oct 27, 2017
ba82d42
Simply sets nan gradients to zero instead of nan_to_num
jayantj Oct 27, 2017
71f61d1
Adds batch-wise implementation of training and gradient computations
jayantj Oct 27, 2017
2a5a7fb
Minor correction in clipping
jayantj Oct 30, 2017
0c57aa1
Merge branch 'poincare' into poincare_model
jayantj Oct 30, 2017
9c51609
Fixes typo in clip_vectors
jayantj Oct 30, 2017
f22d9b2
Prints average loss every few iterations instead of current loss
jayantj Oct 31, 2017
7905c8c
Adds weighted negative sampling
jayantj Nov 2, 2017
075df25
Ensures positive edges are not returned by negative sampling
jayantj Nov 2, 2017
6060e56
Poincare model stores node indices in relations instead of node keys
jayantj Nov 2, 2017
8ea8f23
Minor renaming; uses node indices for batch training instead of node …
jayantj Nov 2, 2017
b8d77e3
Changes shapes of vectors passed to PoincareBatch
jayantj Nov 3, 2017
0011b93
Minor bugfixes related to batch size
jayantj Nov 3, 2017
b52ee2e
Corrects implementation of negative sampling for batch training
jayantj Nov 3, 2017
d247384
Adds option to check gradients in batchwise training
jayantj Nov 3, 2017
8c4f5a3
Checks gradients only every few iterations
jayantj Nov 3, 2017
34b0ad3
Handles multiple occurrence of same node across and within batches
jayantj Nov 3, 2017
1779cd7
Removes unused section of code
jayantj Nov 3, 2017
faacb43
Implements slightly different clipping method
jayantj Oct 31, 2017
c68088e
Fixes bugs with wrong reshape in batchwise training
jayantj Nov 3, 2017
0c2f2cb
Example-wise training takes into account multiple occurrences of same…
jayantj Nov 3, 2017
386f602
Batchwise training prints average loss over many iterations instead o…
jayantj Nov 3, 2017
f0fb9e9
Fixes bug in updating vector for batchwise training
jayantj Nov 3, 2017
7d8fbec
Faster implementation of negative sampling
jayantj Nov 3, 2017
315f95c
Negative sampling for a node follows different paths depending on fra…
jayantj Nov 6, 2017
0802dd5
Uses a buffer for negative samples to reduce calls to np.random.choice
jayantj Nov 6, 2017
a106191
Cleans up poincare.py, removes unused code
jayantj Nov 6, 2017
1aa586d
Adds shapes to PoincareBatch, more documentation
jayantj Nov 6, 2017
13b00dc
Adds more documentation to PoincareModel
jayantj Nov 6, 2017
5978af6
Stores indices for nodes in a batch in PoincareBatch for better encap…
jayantj Nov 6, 2017
e40c3e3
More documentation for poincare module
jayantj Nov 6, 2017
ec8b516
Implements burn-in for poincare model
jayantj Nov 6, 2017
86ae4d6
Slightly better logging for poincare model
jayantj Nov 6, 2017
ac51e9c
Uses np.random.random and np.searchsorted for random sampling rather …
jayantj Nov 7, 2017
5900c6f
Removes duplicates in negative samples
jayantj Nov 7, 2017
4ac4d2e
Moves helper classes in poincare after PoincareModel
jayantj Nov 7, 2017
9eb6f48
Change in PoincareModel API to allow initializing from an iterable, s…
jayantj Nov 7, 2017
2ded72b
Adds failing test for handling encoding in PoincareData
jayantj Nov 7, 2017
81960e1
Fixes encoding handling in PoincareData
jayantj Nov 7, 2017
5de194b
Adds docstrings to PoincareData, PoincareData streams tuples now
jayantj Nov 7, 2017
6dd6915
More unittests for PoincareModel
jayantj Nov 8, 2017
4b502af
Changes handle_duplicates to staticmethod, adds test
jayantj Nov 8, 2017
12be121
Adds batch size and print_every parameters to train method
jayantj Nov 8, 2017
29e799c
Renames print_check to should_print
jayantj Nov 8, 2017
b4ff1dd
Adds separate parameter for checking gradients
jayantj Nov 8, 2017
e2f72bc
Minor fixes for coding style
jayantj Nov 8, 2017
953b4a7
Removes default values from docstrings, redundant
jayantj Nov 8, 2017
eebc12a
Adds example to PoincareModel init docstring
jayantj Nov 8, 2017
21a1c82
Extracts buffer for negatives out into a separate class
jayantj Nov 8, 2017
f9325ea
More detailed logging, fix to check_gradients
jayantj Nov 8, 2017
5db8456
Minor fixes to documentation in poincare.py
jayantj Nov 8, 2017
53030a0
Adds tests for gradients checking
jayantj Nov 8, 2017
db0d293
Raise AssertionError if gradients check fails
jayantj Nov 8, 2017
1adf81a
Adds failing tests for saving/loading PoincareModel instances
jayantj Nov 8, 2017
3898089
Fixes bug with saving/loading PoincareModel to disk
jayantj Nov 8, 2017
5cd913a
Adds test and fix for raising error on invalid input data
jayantj Nov 8, 2017
6305228
Adds test and fix for no duplicates and positives in negative sample
jayantj Nov 8, 2017
fb13eb5
Bugfix with NegativesBuffer having less than items left
jayantj Nov 8, 2017
ea2fd48
Uses larger data for poincare tests, adds data files
jayantj Nov 8, 2017
110fb1e
Bugfix with incorrect use of random state
jayantj Nov 8, 2017
0aeec2f
Minor fixes in documentation style
jayantj Nov 8, 2017
38feb7a
Renames PoincareData to PoincareRelations
jayantj Nov 9, 2017
0e7ebb3
Change in the order of conditions checked before resampling
jayantj Nov 9, 2017
52a1e57
Merge branch 'poincare' into poincare_model
jayantj Nov 9, 2017
630771d
Imports datapath from test.utils instead of defining own
jayantj Nov 9, 2017
7c6d972
Adds working examples and a more detailed description in docstring
jayantj Nov 9, 2017
16dcf0b
Renames term_relations to node_relations
jayantj Nov 9, 2017
3501d6f
Removes unused imports
jayantj Nov 9, 2017
d690a25
Moves iter parameter to train instead of __init__, renames to epochs
jayantj Nov 9, 2017
2383e82
Fixes term_relations in tests
jayantj Nov 9, 2017
3ed0bea
Adds option to disable gradient check, disabled by default
jayantj Nov 9, 2017
9f562cb
Extracts gradient checking code into a separate method
jayantj Nov 9, 2017
98e078d
Conditionally import autograd only if gradient checking is enabled
jayantj Nov 9, 2017
530146d
Marks private methods in poincare module with leading underscore
jayantj Nov 9, 2017
d17c075
Adds init_range as an API parameter to PoincareModel
jayantj Nov 9, 2017
be0249a
Marks private properties with a leading underscore
jayantj Nov 9, 2017
dc2ab95
Fixes bug with burn-in happening on subsequent calls to train
jayantj Nov 9, 2017
a306f20
Adds test for training multiple times
jayantj Nov 9, 2017
f9750e6
Adds autograd to test dependencies
jayantj Nov 9, 2017
b7212ff
Renames wv to kv in PoincareModel
jayantj Nov 9, 2017
3556ee4
add numpy==1.12 as test dependency
menshikh-iv Nov 10, 2017
4644eda
add missing quote
menshikh-iv Nov 10, 2017
94a2a18
try to run tests without autograd
menshikh-iv Nov 13, 2017
7a4ec79
fix PEP8 in poincare.py
menshikh-iv Nov 13, 2017
613ca38
fix PEP8 in test_poincare
menshikh-iv Nov 13, 2017
3029d41
PoincareRelations handles python2 correctly
jayantj Nov 13, 2017
055044c
Bugfix with int division for python2
jayantj Nov 13, 2017
f75491f
Imports mock module for tests correctly in python2
jayantj Nov 13, 2017
59fcf8b
Cleaner implementation of __iter__ for PoincareRelations
jayantj Nov 13, 2017
dcbe7aa
Adds rst file and updates apiref.rst for poincare module
jayantj Nov 13, 2017
b69f51f
Adds clarifying comment to PoincareRelations.__iter__
jayantj Nov 13, 2017
001ec76
Updates rst file for poincare
jayantj Nov 13, 2017
9446a05
Renames hypernym pair to relations everywhere
jayantj Nov 13, 2017
930dfd4
Simpler way of detecting duplicates
jayantj Nov 13, 2017
355e521
Minor documentation updates in poincare.py
jayantj Nov 14, 2017
0d5175c
Skips gradients test if autograd not installed, adds test for bytes i…
jayantj Nov 14, 2017
00ca7ab
Fix flake8 (noqa + remove unused var)
menshikh-iv Nov 14, 2017
8ff23ae
Fix missing mock dependency for win
menshikh-iv Nov 14, 2017
30ac3e6
Fix links in docstrings
menshikh-iv Nov 14, 2017
a928ca1
Changes error message for negative sampling failing
jayantj Nov 15, 2017
dfc19cb
Adds option to specify dtype for PoincareModel and corresponding unit…
jayantj Nov 15, 2017
e967c54
Extends test for dtype to check after training, updates docstring
jayantj Nov 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/apiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Modules:
models/doc2vec
models/fasttext
models/phrases
models/poincare
models/coherencemodel
models/basemodel
models/callbacks
Expand Down
10 changes: 10 additions & 0 deletions docs/src/models/poincare.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:mod:`models.poincare` -- Train and use Poincare embeddings
==========================================================

.. automodule:: gensim.models.poincare
:synopsis: Train and use Poincare embeddings
:members:
:inherited-members:
:special-members:
:undoc-members:
:show-inheritance:
Loading