ldavis: Visualise Latent Dirichlet Allocation Models

Description Usage Arguments Details Examples

Description

Visualise Latent Dirichlet Allocation models with pyLDAvis.

Usage

 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)

Arguments

model

A model as returned by model_lda.

corpus

A corpus as returned by doc2bow.

dictionary

A dictionary as returned by corpora_dictionary.

...

Additional arguments from the official documentation.

prepared_vis

Prepapred vis as returned by prepapre_ldavis.

Details

plot_ldavis is a wrapper around prepapre_ldavis and show_ldavis. Note that a plot method that can be used instead of show_ldavis.

Examples

 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)

news-r/gensimr documentation built on Jan. 9, 2021, 5:55 a.m.