DETM#
Module Contents#
The Dynamic Embedded Topic Model. 2019 |
- class DETM(vocab_size, num_times, train_size, train_time_wordfreq, num_topics=50, train_WE=True, pretrained_WE=None, en_units=800, eta_hidden_size=200, rho_size=300, enc_drop=0.0, eta_nlayers=3, eta_dropout=0.0, delta=0.005, theta_act='relu', device='cpu')#
Bases:
torch.nn.ModuleThe Dynamic Embedded Topic Model. 2019
Adji B. Dieng, Francisco J. R. Ruiz, David M. Blei
- property word_embeddings#
- property topic_embeddings#
- get_activation(act)#
- reparameterize(mu, logvar)#
Returns a sample from a Gaussian distribution via reparameterization.
- get_kl(q_mu, q_logsigma, p_mu=None, p_logsigma=None)#
Returns KL( N(q_mu, q_logsigma) || N(p_mu, p_logsigma) ).
- get_alpha()#
- get_eta(rnn_inp)#
- get_theta(bows, times, eta=None)#
Returns the topic proportions.
- get_beta(alpha=None)#
Returns the topic matrix eta of shape T x K x V
- get_NLL(theta, beta, bows)#
- forward(bows, times)#
Initializes the first hidden state of the RNN used as inference network for eta.