LDAModel (Spark 3.5.5 JavaDoc) (original) (raw)
Object
- org.apache.spark.mllib.clustering.LDAModel
All Implemented Interfaces:
Saveable
Direct Known Subclasses:
DistributedLDAModel, LocalLDAModel
public abstract class LDAModel
extends Object
implements Saveable
Latent Dirichlet Allocation (LDA) model.
This abstraction permits for different underlying representations, including local and distributed data structures.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods
Modifier and Type Method and Description 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 Vector docConcentration() Concentration parameter (commonly named "alpha") for the prior placed on documents' distributions over topics ("theta"). abstract int k() Number of topics abstract double topicConcentration() Concentration parameter (commonly named "beta" or "eta") for the prior placed on topics' distributions over terms. 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` * ### Methods inherited from interface org.apache.spark.mllib.util.[Saveable](../../../../../org/apache/spark/mllib/util/Saveable.html "interface in org.apache.spark.mllib.util") `[save](../../../../../org/apache/spark/mllib/util/Saveable.html#save-org.apache.spark.SparkContext-java.lang.String-)`
Method Detail
* #### describeTopics public abstract scala.Tuple2<int[],double[]>[] describeTopics(int maxTermsPerTopic) Return the topics described by weighted terms. 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. * #### docConcentration public abstract [Vector](../../../../../org/apache/spark/mllib/linalg/Vector.html "interface in org.apache.spark.mllib.linalg") docConcentration() Concentration parameter (commonly named "alpha") for the prior placed on documents' distributions over topics ("theta"). This is the parameter to a Dirichlet distribution. Returns: (undocumented) * #### k public abstract int k() Number of topics * #### topicConcentration public abstract double topicConcentration() Concentration parameter (commonly named "beta" or "eta") for the prior placed on topics' distributions over terms. This is the parameter to a symmetric Dirichlet distribution. Returns: (undocumented) Note: The topics' distributions over terms are called "beta" in the original LDA paper by Blei et al., but are called "phi" in many later papers such as Asuncion et al., 2009. * #### topicsMatrix public abstract [Matrix](../../../../../org/apache/spark/mllib/linalg/Matrix.html "interface in org.apache.spark.mllib.linalg") 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) * #### vocabSize public abstract int vocabSize() Vocabulary size (number of terms or terms in the vocabulary)