Github user FlytxtRnD commented on a diff in the pull request:
https://github.com/apache/spark/pull/4059#discussion_r23828921
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala ---
@@ -284,6 +285,59 @@ class PythonMLLibAPI extends Serializable {
}
/**
+ * Java stub for Python mllib GaussianMixtureEM.train()
+ * Returns a list containing weights, mean and covariance of each
mixture component.
+ */
+ def trainGaussianMixtureEM(
+ data: JavaRDD[Vector],
+ k: Int,
+ convergenceTol: Double,
+ seed: Long,
+ maxIterations: Int): JList[Object] = {
+ val gmmAlg = new GaussianMixtureEM()
+ .setK(k)
+ .setConvergenceTol(convergenceTol)
+ .setSeed(seed)
+ .setMaxIterations(maxIterations)
+ try {
+ val model =
gmmAlg.run(data.rdd.persist(StorageLevel.MEMORY_AND_DISK))
+ var wtArray:Array[Double] = Array()
--- End diff --
Instead of passing mu & sigma as arrays, I tried to directly pass
"gaussians "(Array[MultivariateGaussian]). But I was not able to access the
attributes of the MultivariateGaussian class object in python. Then I converted
"gaussians" to 2 arrays of mu and sigma and returned to python. Which method is
good? And is it possible to access the attributes mu & sigma in python by
passing "gaussians" directly?
---
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]