rguthrie3 / morphologicalpriorsforwordembeddings Goto Github PK
View Code? Open in Web Editor NEWCode for EMNLP 2016 paper: Morphological Priors for Probabilistic Word Embeddings
Code for EMNLP 2016 paper: Morphological Priors for Probabilistic Word Embeddings
I was just going through the paper and trying to reproduce the results, and the code has been very helpful so far, thanks a lot for publishing it.
I'm curious about equation (23) from the paper for KL divergence and its implementation in the code -
def kl_div(self, x, y):
"""
Compute sum of D(x_i || y_i) for each corresponding element
along the 3rd dimension (the embedding dimension)
of x and y
This function takes care to not compute logarithms that are close
to 0, since NaN's could result for log(sigmoid(x)) if x is negative.
It simply uses that log(sigmoid(x)) = - log(1 + e^-x)
"""
sig_x = T.nnet.sigmoid(x)
exp_x = T.exp(-x)
exp_y = T.exp(-y)
one_p_exp_x = exp_x + 1
one_p_exp_y = exp_y + 1
return (sig_x * (T.log(one_p_exp_y) - T.log(one_p_exp_x)) + (1 - sig_x) * (T.log(exp_y) - T.log(exp_x))).mean()
I'm a little unsure about some of the terms (especially T.log(exp_y) - T.log(exp_x)
), am I missing a possible simplification? Or was a modified version of the equation used in the final version?
Thanks!
We are in process of integrating your work on word embedding models, into Gensim (Link of PR). Your code has been of great help in this. Thanks a lot.
I found there is going to be a new release of Morfessor soon, where methods to read_binary_model_file
will be deprecated soon. See Issue in Morfessor for more information regarding this. So, just wanted to notify regarding, you could shift on to using the 'text' format for saving models.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.