Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/7166#discussion_r34177389
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixture.scala ---
@@ -140,6 +143,9 @@ class GaussianMixture private (
// Get length of the input vectors
val d = breezeData.first().length
+ // Logic for when to distribute the computation of the
[[MultivariateGaussian]]s
+ val distributeGaussians = d >= 30 && k >= 10
--- End diff --
The computation cost is `C1 * k * d^3` and the communication cost for
distributing Gaussian is `C2 * k * d^2`, where `C1` and `C2` are constants. So
if we run on local (assuming single thread), the total time is C1 * k * d^3, if
we distribute the work, the total time is `C1 * d^3 + C2 * k * d^2`. So we
should distribute the work when `(k - 1) / k * d > C2 / C1`, which is roughly
controlled by `d` for a non-trivial `k`. Based on your performance test, `C2 /
C1` is roughly 25. So we can use `(k - 1.0) / k * d > 25` here. The logic you
suggested didn't cover the case when k is small but d is very large.
---
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]