-
-
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
[MRG] Poincare l2 regularization #1734
Conversation
…ectors and PoincareKeyedVectors
…nce and vector_distance_batch
@@ -91,6 +91,8 @@ def __init__(self, train_data, size=50, alpha=0.1, negative=10, workers=1, epsil | |||
Number of threads to use for training the model. | |||
epsilon : float, optional | |||
Constant used for clipping embeddings below a norm of one. | |||
regularization_coeff : float, optional |
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.
Can the L2 regularization be disabled? Setting regularization_coeff = 0.0
should do it, correct? Might be worth mentioning here.
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.
That's correct. Good point, adding.
…arization Conflicts: gensim/models/keyedvectors.py gensim/models/poincare.py gensim/viz/__init__.py gensim/viz/poincare.py
… poincare_l2_regularization
Adds l2-regularization for Poincare embeddings, which improves results and results in models much more similar to the models visualized in the original paper. To be merged post #1700
Without regularization, the model looks like this -
The problem with this is that most of the nodes are too close to the boundary. In order to prevent this, l2-regularization is added to only the parent node in the training hypernymy relations, which results in the following model -
Also adds cleaner handling of autograd, where the import is not conditional, however if autograd cannot be imported, gradient checking is automatically skipped along with a warning.