Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/6087#discussion_r30195900
--- Diff: python/pyspark/mllib/clustering.py ---
@@ -208,13 +235,21 @@ class GaussianMixture(object):
:param convergenceTol: Threshold value to check the convergence
criteria. Defaults to 1e-3
:param maxIterations: Number of iterations. Default to 100
:param seed: Random Seed
+ :param initialModel: The initial GMM starting point
"""
@classmethod
- def train(cls, rdd, k, convergenceTol=1e-3, maxIterations=100,
seed=None):
+ def train(cls, rdd, k, convergenceTol=1e-3, maxIterations=100,
seed=None, initialModel=None):
"""Train a Gaussian Mixture clustering model."""
- weight, mu, sigma = callMLlibFunc("trainGaussianMixture",
- rdd.map(_convert_to_vector), k,
- convergenceTol, maxIterations,
seed)
+ initialModelWeights = None
+ initialModelMu = None
+ initialModelSigma = None
+ if initialModel is not None:
+ initialModelWeights = initialModel.weights
--- End diff --
Could you please check if k == initialModel.k here and raise an error with
a nice message if not?
---
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]