Class/Object

ml.combust.mleap.core.clustering

LocalLDAModel

Related Docs: object LocalLDAModel | package clustering

Permalink

case class LocalLDAModel(topics: Matrix[Double], docConcentration: DenseVector[Double], topicConcentration: Double, gammaShape: Double = 100) extends LDAModel with Model with Product with Serializable

Local LDA model. This model stores only the inferred topics.

topics

Inferred topics (vocabSize x k matrix).

Linear Supertypes
Serializable, Serializable, Product, Equals, Model, LDAModel, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LocalLDAModel
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Model
  7. LDAModel
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LocalLDAModel(topics: Matrix[Double], docConcentration: DenseVector[Double], topicConcentration: Double, gammaShape: Double = 100)

    Permalink

    topics

    Inferred topics (vocabSize x k matrix).

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def describeTopics(maxTermsPerTopic: Int): Array[(Array[Int], Array[Double])]

    Permalink

    Return the topics described by weighted terms.

    Return the topics described by weighted terms.

    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.

    Definition Classes
    LocalLDAModelLDAModel
  7. def describeTopics(): Array[(Array[Int], Array[Double])]

    Permalink

    Return the topics described by weighted terms.

    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.

    Definition Classes
    LDAModel
  8. val docConcentration: DenseVector[Double]

    Permalink

    Concentration parameter (commonly named "alpha") for the prior placed on documents' distributions over topics ("theta").

    Concentration parameter (commonly named "alpha") for the prior placed on documents' distributions over topics ("theta").

    This is the parameter to a Dirichlet distribution.

    Definition Classes
    LocalLDAModelLDAModel
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. val gammaShape: Double

    Permalink

    Shape parameter for random initialization of variational parameter gamma.

    Shape parameter for random initialization of variational parameter gamma. Used for variational inference for perplexity and other test-time computations.

    Attributes
    protected
    Definition Classes
    LocalLDAModelLDAModel
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def inputSchema: StructType

    Permalink
    Definition Classes
    LocalLDAModelModel
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. def k: Int

    Permalink

    Number of topics

    Number of topics

    Definition Classes
    LocalLDAModelLDAModel
  16. def logLikelihood(documents: Array[(Long, Vector[Double])]): Double

    Permalink

    Calculates a lower bound on the log likelihood of the entire corpus.

    Calculates a lower bound on the log likelihood of the entire corpus.

    TODO: declare in LDAModel and override once implemented in DistributedLDAModel See Equation (16) in original Online LDA paper.

    documents

    test corpus to use for calculating log likelihood

    returns

    variational lower bound on the log likelihood of the entire corpus

  17. def logPerplexity(documents: Array[(Long, Vector[Double])]): Double

    Permalink

    Calculate an upper bound bound on perplexity.

    Calculate an upper bound bound on perplexity. (Lower is better.) See Equation (16) in original Online LDA paper.

    documents

    test corpus to use for calculating perplexity

    returns

    Variational upper bound on log perplexity per token.

  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. def outputSchema: StructType

    Permalink
    Definition Classes
    LocalLDAModelModel
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. val topicConcentration: Double

    Permalink

    Concentration parameter (commonly named "beta" or "eta") for the prior placed on topics' distributions over terms.

    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.

    Definition Classes
    LocalLDAModelLDAModel
    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.

  24. def topicDistribution(document: Vector[Double]): Vector[Double]

    Permalink

    Predicts the topic mixture distribution for a document (often called "theta" in the literature).

    Predicts the topic mixture distribution for a document (often called "theta" in the literature). Returns a vector of zeros for an empty document.

    Note this means to allow quick query for single document. For batch documents, please refer to topicDistributions() to avoid overhead.

    document

    document to predict topic mixture distributions for

    returns

    topic mixture distribution for the document

  25. def topicDistributions(documents: Array[(Long, Vector[Double])]): Array[(Long, Vector[Double])]

    Permalink

    Predicts the topic mixture distribution for each document (often called "theta" in the literature).

    Predicts the topic mixture distribution for each document (often called "theta" in the literature). Returns a vector of zeros for an empty document.

    This uses a variational approximation following Hoffman et al. (2010), where the approximate distribution is called "gamma." Technically, this method returns this approximation "gamma" for each document.

    documents

    documents to predict topic mixture distributions for

    returns

    An RDD of (document ID, topic mixture distribution for document)

  26. val topics: Matrix[Double]

    Permalink

    Inferred topics (vocabSize x k matrix).

  27. def topicsMatrix: Matrix[Double]

    Permalink

    Inferred topics, where each topic is represented by a distribution over terms.

    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.

    Definition Classes
    LocalLDAModelLDAModel
  28. def vocabSize: Int

    Permalink

    Vocabulary size (number of terms or terms in the vocabulary)

    Vocabulary size (number of terms or terms in the vocabulary)

    Definition Classes
    LocalLDAModelLDAModel
  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Model

Inherited from LDAModel

Inherited from AnyRef

Inherited from Any

Ungrouped