topicmod.model_io

Functions for printing/exporting topic models.

Markus Konrad <markus.konrad@wzb.eu>

Module Contents

Functions

ldamodel_top_topic_words(topic_word_distrib,vocab,top_n=10,val_fmt=None,col_labels=None,index_name=None)
ldamodel_top_doc_topics(doc_topic_distrib,doc_labels,top_n=3,val_fmt=None,col_labels=None,index_name=None)
ldamodel_full_topic_words(topic_word_distrib,vocab,fmt_rownames=DEFAULT_TOPIC_NAME_FMT)
ldamodel_full_doc_topics(doc_topic_distrib,doc_labels,fmt_colnames=DEFAULT_TOPIC_NAME_FMT)
print_ldamodel_distribution(distrib,row_labels,val_labels,top_n=10) Print n_top top values from a LDA model’s distribution distrib. Can be used for topic-word distributions and
print_ldamodel_topic_words(topic_word_distrib,vocab,n_top=10,row_labels=DEFAULT_TOPIC_NAME_FMT) Print n_top values from a LDA model’s topic-word distributions.
print_ldamodel_doc_topics(doc_topic_distrib,doc_labels,n_top=3,val_labels=DEFAULT_TOPIC_NAME_FMT) Print n_top values from a LDA model’s document-topic distributions.
save_ldamodel_summary_to_excel(excel_file,topic_word_distrib,doc_topic_distrib,doc_labels,vocab,top_n_topics=10,top_n_words=10,dtm=None,rank_label_fmt=None,topic_label_fmt=None)
save_ldamodel_to_pickle(picklefile,model,vocab,doc_labels,dtm=None,**kwargs) Save a LDA model as pickle file.
load_ldamodel_from_pickle(picklefile,**kwargs) Load a LDA model from a pickle file.
ldamodel_top_topic_words(topic_word_distrib, vocab, top_n=10, val_fmt=None, col_labels=None, index_name=None)
ldamodel_top_doc_topics(doc_topic_distrib, doc_labels, top_n=3, val_fmt=None, col_labels=None, index_name=None)
ldamodel_full_topic_words(topic_word_distrib, vocab, fmt_rownames=DEFAULT_TOPIC_NAME_FMT)
ldamodel_full_doc_topics(doc_topic_distrib, doc_labels, fmt_colnames=DEFAULT_TOPIC_NAME_FMT)
print_ldamodel_distribution(distrib, row_labels, val_labels, top_n=10)

Print n_top top values from a LDA model’s distribution distrib. Can be used for topic-word distributions and document-topic distributions.

print_ldamodel_topic_words(topic_word_distrib, vocab, n_top=10, row_labels=DEFAULT_TOPIC_NAME_FMT)

Print n_top values from a LDA model’s topic-word distributions.

print_ldamodel_doc_topics(doc_topic_distrib, doc_labels, n_top=3, val_labels=DEFAULT_TOPIC_NAME_FMT)

Print n_top values from a LDA model’s document-topic distributions.

save_ldamodel_summary_to_excel(excel_file, topic_word_distrib, doc_topic_distrib, doc_labels, vocab, top_n_topics=10, top_n_words=10, dtm=None, rank_label_fmt=None, topic_label_fmt=None)
save_ldamodel_to_pickle(picklefile, model, vocab, doc_labels, dtm=None, **kwargs)

Save a LDA model as pickle file.

load_ldamodel_from_pickle(picklefile, **kwargs)

Load a LDA model from a pickle file.