ysmiao / nvdm Goto Github PK
View Code? Open in Web Editor NEWneural variational document model
neural variational document model
I ran into minor issues when using Python 3.
ids=range(data_size)
to ids = np.arange(data_size)
which consequently, changing the padding line tobatches.append(np.append(ids[-rest:], ([-1] * (batch_size - rest)))) # -1 as padding
An updated version of Tensorflow changed the matrix multiplication from 'tf.mul' to 'tf.multiply'.
In the paper, it says that the 20news dataset has 11,314 training and 7,531 test articles.
However, why the data you give in this repository has only 11,268 training and 7,505 test articles?
I assume that row number of each word in vocabs.new is the index of the word, and the integer after each word is counts of that word in corpus, am I right ?
Thank you! (for my purposes a commercially-friendly license, e.g. Apache / MIT / Berkeley would be awesome.)
I can't understand why setting matrix_start_zero=True
when computing logsigm
at line 54, nvdm.py , would you mind making a brief explanation, thanks.
I ran the original code for NVDM and found that the kld loss curve decreased and then quickly increased.
According to the ELBO, B = -KL[q(z|x) || p(z)] + E[p(x|z)]. Maximizing this bound is equivalent to minimizing KL[q(z|x) || p(z)] and maximizing E[p(x|z)]. The KLD curve should approach to zero, because KL[q(z|x) || p(z)] >= 0.
The experimental result is strange.
Hi! So the perplexity calculation here is (per line 140 from "train" in nvdm.py):
print_ppx = np.exp(loss_sum / word_count)
However, loss_sum is based on the sum of "loss" which is the result of "model.objective" i.e. the sum of reconstruction loss (cross-entropy) and K-L Divergence.
Lines 129-132 from "train" in nvdm.py
_, (loss, kld) = sess.run((optim,
[model.objective, model.kld]),
input_feed)
loss_sum += np.sum(loss)
Line 78 the model definition in nvdm.py
self.objective = self.recons_loss + self.kld
I thought Perplexity is usually the exponentiated form of the normalized cross-entropy, so is there a technical reason for using the result of model.objective instead of model.recons_loss to calculate the perplexity or is that a bug? I bet numbers should only get better if this is corrected (as KL Divergence is non-negative)
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.