Class/Object

org.apache.spark.mllib.clustering

LocalLDAModel

Related Docs: object LocalLDAModel | package clustering

Permalink

class LocalLDAModel extends LDAModel with Serializable

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

Annotations
@Since( "1.3.0" )
Source
LDAModel.scala
Linear Supertypes
Serializable, Serializable, LDAModel, Saveable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LocalLDAModel
  2. Serializable
  3. Serializable
  4. LDAModel
  5. Saveable
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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
    Annotations
    @Since( "1.3.0" )
  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
    Annotations
    @Since( "1.3.0" )
  8. val docConcentration: Vector

    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
    Annotations
    @Since( "1.5.0" )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def formatVersion: String

    Permalink

    Current version of model save/load format.

    Current version of model save/load format.

    Attributes
    protected
    Definition Classes
    LocalLDAModelSaveable
  13. 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[org.apache.spark]
    Definition Classes
    LocalLDAModelLDAModel
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. def k: Int

    Permalink

    Number of topics

    Number of topics

    Definition Classes
    LocalLDAModelLDAModel
    Annotations
    @Since( "1.3.0" )
  18. def logLikelihood(documents: JavaPairRDD[Long, Vector]): Double

    Permalink

    Java-friendly version of logLikelihood

    Java-friendly version of logLikelihood

    Annotations
    @Since( "1.5.0" )
  19. def logLikelihood(documents: RDD[(Long, Vector)]): 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.

    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

    Annotations
    @Since( "1.5.0" )
  20. def logPerplexity(documents: JavaPairRDD[Long, Vector]): Double

    Permalink

    Java-friendly version of logPerplexity

    Java-friendly version of logPerplexity

    Annotations
    @Since( "1.5.0" )
  21. def logPerplexity(documents: RDD[(Long, Vector)]): Double

    Permalink

    Calculate an upper bound on perplexity.

    Calculate an upper 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.

    Annotations
    @Since( "1.5.0" )
  22. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  25. def save(sc: SparkContext, path: String): Unit

    Permalink

    Save this model to the given path.

    Save this model to the given path.

    This saves:

    • human-readable (JSON) model metadata to path/metadata/
    • Parquet formatted data to path/data/

    The model may be loaded using Loader.load.

    sc

    Spark context used to save model data.

    path

    Path specifying the directory in which to save this model. If the directory already exists, this method throws an exception.

    Definition Classes
    LocalLDAModelSaveable
    Annotations
    @Since( "1.5.0" )
  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  27. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  28. 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
    Annotations
    @Since( "1.5.0" )
    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.

  29. def topicDistribution(document: Vector): Vector

    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

    Annotations
    @Since( "2.0.0" )
  30. def topicDistributions(documents: JavaPairRDD[Long, Vector]): JavaPairRDD[Long, Vector]

    Permalink

    Java-friendly version of topicDistributions

    Java-friendly version of topicDistributions

    Annotations
    @Since( "1.4.1" )
  31. def topicDistributions(documents: RDD[(Long, Vector)]): RDD[(Long, Vector)]

    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)

    Annotations
    @Since( "1.3.0" )
  32. val topics: Matrix

    Permalink

    Inferred topics (vocabSize x k matrix).

    Inferred topics (vocabSize x k matrix).

    Annotations
    @Since( "1.3.0" )
  33. def topicsMatrix: Matrix

    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
    Annotations
    @Since( "1.3.0" )
  34. 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
    Annotations
    @Since( "1.3.0" )
  35. final def wait(): Unit

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

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

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

Inherited from Serializable

Inherited from Serializable

Inherited from LDAModel

Inherited from Saveable

Inherited from AnyRef

Inherited from Any

Ungrouped