org.apache.spark.mllib.clustering
Class LDAModel

Object
  extended by org.apache.spark.mllib.clustering.LDAModel
Direct Known Subclasses:
DistributedLDAModel, LocalLDAModel

public abstract class LDAModel
extends Object

:: Experimental ::

Latent Dirichlet Allocation (LDA) model.

This abstraction permits for different underlying representations, including local and distributed data structures.


Method Summary
 scala.Tuple2<int[],double[]>[] describeTopics()
          Return the topics described by weighted terms.
abstract  scala.Tuple2<int[],double[]>[] describeTopics(int maxTermsPerTopic)
          Return the topics described by weighted terms.
abstract  int k()
          Number of topics
abstract  Matrix topicsMatrix()
          Inferred topics, where each topic is represented by a distribution over terms.
abstract  int vocabSize()
          Vocabulary size (number of terms or terms in the vocabulary)
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

k

public abstract int k()
Number of topics


vocabSize

public abstract int vocabSize()
Vocabulary size (number of terms or terms in the vocabulary)


topicsMatrix

public abstract Matrix topicsMatrix()
Inferred topics, where each topic is represented by a distribution over terms. This is a matrix of size vocabSize x k, where each column is a topic. No guarantees are given about the ordering of the topics.

Returns:
(undocumented)

describeTopics

public abstract scala.Tuple2<int[],double[]>[] describeTopics(int maxTermsPerTopic)
Return the topics described by weighted terms.

This limits the number of terms per topic. This is approximate; it may not return exactly the top-weighted terms for each topic. To get a more precise set of top terms, increase maxTermsPerTopic.

Parameters:
maxTermsPerTopic - Maximum number of terms to collect for each topic.
Returns:
Array over topics. Each topic is represented as a pair of matching arrays: (term indices, term weights in topic). Each topic's terms are sorted in order of decreasing weight.

describeTopics

public scala.Tuple2<int[],double[]>[] describeTopics()
Return the topics described by weighted terms.

WARNING: If vocabSize and k are large, this can return a large object!

Returns:
Array over topics. Each topic is represented as a pair of matching arrays: (term indices, term weights in topic). Each topic's terms are sorted in order of decreasing weight.