Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10242#discussion_r60470048
  
    --- Diff: python/pyspark/ml/clustering.py ---
    @@ -310,6 +311,374 @@ def _create_model(self, java_model):
             return BisectingKMeansModel(java_model)
     
     
    +class LDAModel(JavaModel):
    +    """
    +    A clustering model derived from the LDA method.
    +
    +    .. versionadded:: 2.0.0
    +    """
    +
    +    @since("2.0.0")
    +    def isDistributed(self):
    +        """Indicates whether this instance is of type 
DistributedLDAModel"""
    +        return self._call_java("isDistributed")
    +
    +    @since("2.0.0")
    +    def vocabSize(self):
    +        """Vocabulary size (number of terms or terms in the vocabulary)"""
    +        return self._call_java("vocabSize")
    +
    +    @since("2.0.0")
    +    def topicsMatrix(self):
    +        """ 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.
    +
    +        WARNING: If this model is actually a [[DistributedLDAModel]] 
instance produced by
    +        the Expectation-Maximization ("em") [[optimizer]], then this 
method could involve
    +        collecting a large amount of data to the driver (on the order of 
vocabSize x k).
    +        """
    +        return self._call_java("topicsMatrix")
    +
    +    @since("2.0.0")
    +    def logLikelihood(self, dataset):
    +        """Calculates a lower bound on the log likelihood of the entire 
corpus.
    +        See Equation (16) in the Online LDA paper (Hoffman et al., 2010).
    +
    +        WARNING: If this model is an instance of [[DistributedLDAModel]] 
(produced when
    +        [[optimizer]] is set to "em"), this involves collecting a large 
[[topicsMatrix]] to the
    +        driver. This implementation may be changed in the future.
    +        """
    +        return self._call_java("logLikelihood", dataset)
    +
    +    @since("2.0.0")
    +    def logPerplexity(self, dataset):
    +        """Calculate an upper bound bound on perplexity.  (Lower is 
better.)
    +        See Equation (16) in the Online LDA paper (Hoffman et al., 2010).
    +
    +        WARNING: If this model is an instance of [[DistributedLDAModel]] 
(produced when
    +        [[optimizer]] is set to "em"), this involves collecting a large 
[[topicsMatrix]] to the
    +        driver. This implementation may be changed in the future.
    +        """
    +        return self._call_java("logPerplexity", dataset)
    +
    +    @since("2.0.0")
    +    def describeTopics(self, maxTermsPerTopic=10):
    +        """Return the topics described by their top-weighted terms.
    +
    +        WARNING: If vocabSize and k are large, this can return a large 
object!
    +        """
    +        return self._call_java("describeTopics", maxTermsPerTopic)
    +
    +    @since("2.0.0")
    +    def estimatedDocConcentration(self):
    +        """Value for [[docConcentration]] estimated from data.
    +        If Online LDA was used and [[optimizeDocConcentration]] was set to 
false,
    +        then this returns the fixed (given) value for the 
[[docConcentration]] parameter.
    +        """
    +        return self._call_java("estimatedDocConcentration")
    +
    +
    +class DistributedLDAModel(LDAModel):
    +    """
    +    Model fitted by LDA.
    +
    +    .. versionadded:: 2.0.0
    +    """
    +    def toLocal(self):
    +        return self._call_java("toLocal")
    +
    +
    +class LocalLDAModel(LDAModel):
    +    """
    +    Model fitted by LDA.
    --- End diff --
    
    Copy doc from Scala for this class


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to