def latent_dirichlet_allocation(concentration, topics_words):
topics = ed.Dirichlet(concentration=concentration, name="<STR_LIT>")<EOL>word_probs = tf.matmul(topics, topics_words)<EOL>bag_of_words = ed.OneHotCategorical(probs=word_probs, name="<STR_LIT>")<EOL>return bag_of_words<EOL>
Latent Dirichlet Allocation in terms of its generative process.

    The model posits a distribution over bags of words and is parameterized by
    a concentration and the topic-word probabilities. It collapses per-word
    topic assignments.

    Args:
      concentration: A Tensor of shape [1, num_topics], which parameterizes the
        Dirichlet prior over topics.
      topics_words: A Tensor of shape [num_topics, num_words], where each row
        (topic) denotes the probability of each word being in that topic.

    Returns:
      bag_of_words: A random variable capturing a sample from the model, of shape
        [1, num_words]. It represents one generated document as a bag of words.