Description Usage Arguments Details Examples
Visualise Latent Dirichlet Allocation models with pyLDAvis.
1 2 3 4 5 6 7 8 9 10 | prepare_ldavis(model, corpus, dictionary, ...)
show_ldavis(prepared_vis)
## S3 method for class 'pyLDAvis._prepare.PreparedData'
show_ldavis(prepared_vis)
plot_ldavis(model, corpus, dictionary)
ldavis_as_html(prepared_vis)
|
model |
A model as returned by |
corpus |
A corpus as returned by |
dictionary |
A dictionary as returned by |
... |
Additional arguments from the official documentation. |
prepared_vis |
Prepapred vis as returned by |
plot_ldavis
is a wrapper around prepapre_ldavis
and show_ldavis
. Note that a plot
method that can be used
instead of show_ldavis
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | docs <- prepare_documents(corpus)
dict <- corpora_dictionary(docs)
corpora <- doc2bow(dict, docs)
# lda model
model <- model_lda(
corpus = corpora,
id2word = dict,
iterations = 50L,
num_topics = 2L
)
# visualise
vis <- prepare_ldavis(model, corpora, dict)
## Not run: plot(vis)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.