Description Usage Arguments Details Examples
Hierarchical Dirichlet process (HDP) is a powerful mixed-membership model for the unsupervised analysis of grouped data. Unlike its finite counterpart, latent Dirichlet allocation, the HDP topic model infers the number of topics from the data. Here we have used Online HDP, which provides the speed of online variational Bayes with the modeling flexibility of the HDP. The idea behind Online variational Bayes in general is to optimize the variational objective function with stochastic optimization.The challenge we face is that the existing coordinate ascent variational Bayes algorithms for the HDP require complicated approximation methods or numerical optimization. This model utilises stick breaking construction of Hdp which enables it to allow for coordinate-ascent variational Bayes without numerical approximation.
1 2 3 |
corpus |
Model as returned by |
id2word |
Dictionary for the input corpus, as returned by |
... |
Any other options, from the official documentation. |
file |
Path to a saved model. |
This is a non-parametric bayesian method: notice the lack of num_topics
argument.
1 2 3 4 5 6 7 8 | docs <- prepare_documents(corpus)
dictionary <- corpora_dictionary(docs)
corpora <- doc2bow(dictionary, docs)
corpus_mm <- serialize_mmcorpus(corpora, auto_delete = FALSE)
# fit model
hdp <- model_hdp(corpus_mm, id2word = dictionary)
reticulate::py_to_r(hdp$show_topic(topic_id = 1L, topn = 5L))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.