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
- num_topics = 50¶
- num_times¶
- vocab_size¶
- rho_size = 300¶
- enc_drop = 0.0¶
- eta_nlayers = 3¶
- t_drop¶
- eta_dropout = 0.0¶
- delta = 0.005¶
- train_WE = True¶
- train_size¶
- rnn_inp¶
- device = 'cpu'¶
- theta_act = 'relu'¶
- mu_q_alpha¶
- logsigma_q_alpha¶
- q_theta¶
- mu_q_theta¶
- logsigma_q_theta¶
- q_eta_map¶
- q_eta¶
- mu_q_eta¶
- logsigma_q_eta¶
- decoder_bn¶
- 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.
- property word_embeddings¶
- property topic_embeddings¶
- 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.