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

    https://github.com/apache/spark/pull/6087#discussion_r30265296
  
    --- Diff: python/pyspark/mllib/clustering.py ---
    @@ -166,12 +168,38 @@ class GaussianMixtureModel(object):
         True
         >>> labels[3]==labels[4]
         True
    +    >>> clusterdata_3 = sc.parallelize(data.reshape(15, 1))
    +    >>> im = GaussianMixtureModel([0.5, 0.5],
    +    ...      [MultivariateGaussian(Vectors.dense([-1.0]), DenseMatrix(1, 
1, [1.0])),
    +    ...      MultivariateGaussian(Vectors.dense([1.0]), DenseMatrix(1, 1, 
[1.0]))])
    +    >>> model = GaussianMixture.train(clusterdata_3, 2, initialModel=im)
         """
     
         def __init__(self, weights, gaussians):
    -        self.weights = weights
    -        self.gaussians = gaussians
    -        self.k = len(self.weights)
    +        self._weights = weights
    +        self._gaussians = gaussians
    +        self._k = len(self._weights)
    +
    +    @property
    +    def weights(self):
    +        """
    +        Weights for each Gaussian distribution in the mixture, where 
weights(i) is
    +        the weight for Gaussian i, and weight.sum == 1.
    +        """
    +        return self._weights
    +
    +    @property
    +    def gaussians(self):
    +        """
    +        Array of MultivariateGaussian where gaussians(i) represents
    --- End diff --
    
    gaussians[i] (for Python)


---
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