Learn R Programming

textmineR (version 3.0.4)

Cluster2TopicModel: Represent a document clustering as a topic model

Description

Represents a document clustering as a topic model of two matrices. phi: P(term | cluster) theta: P(cluster | document)

Usage

Cluster2TopicModel(dtm, clustering, ...)

Arguments

dtm

A document term matrix of class dgCMatrix or whose class inherits from the Matrix package. Columns must index terms, rows must index documents.

clustering

A vector of length nrow(dtm) whose entries form a partitional clustering of the documents.

...

Other arguments to be passed to TmParallelApply.

Value

Returns a list with two elements, phi and theta. 'phi' is a matrix whose j-th row represents P(terms | cluster_j). 'theta' is a matrix whose j-th row represents P(clusters | document_j). Each row of theta should only have one non-zero element.

Examples

Run this code
# NOT RUN {
# Load pre-formatted data for use
data(nih_sample_dtm)
data(nih_sample) 

result <- Cluster2TopicModel(dtm = nih_sample_dtm, 
                             clustering = nih_sample$IC_NAME)
# }

Run the code above in your browser using DataLab