Function WriteTopics

[ S ] = WriteTopics( WP , BETA , WO ) writes the most likely entities (e.g. words, authors) per topic to a cell array of strings. WP is a sparse W x T count matrix such that WP(i,j) contains the number of times entity i has been assigned to topic j (W=number of entities, T=number of topics). BETA is the relevant hyperparameter used in the Gibbs sampling routine. WO is a cell structure of strings such that WO{i} contains the ith entity string (e.g., word or author name)

[ S ] = WriteTopics( WP , BETA , WO , K , E , M , FILENAME ) writes the K most likely entities per topic to a text file FILENAME with M columns. E is a threshold on the topic listings in S. Only entities that do not exceed this cumulative probability are listed.

WriteTopics( WP , BETA , WO , K , E , M , FILENAME ) writes the K most likely entities per topic without producing a cell array of strings

[ S ] = WriteTopics( WP , BETA , WO ) uses default values K=5 and E=1

Example

   load 'ldasingle_psychreview'
   [ S ] = WriteTopics( WP , BETA , WO )

will list the most likely words per topic in the saved WP sample

   WriteTopics( WP , BETA , WO , 10 , 1.0 , 4 ,
   'topics50_psychreview.txt' )

will write 10 most likely words per topic to a four column text file