title: Why does Spark's GaussianMixture return identical clusters?
body: <p>I'm using spark-1.5.2 to cluster a dataset using <code>GaussianMixture</code>. No errors occur other than the resulting <code>GaussianMixtureModel</code>s and their weights are identical. The number of iterations it takes to reach the specified tolerance is about 2 which seems far too low.</p>
  
  <p>What parameters can I adjust so that clusters form with different values?</p>
  
  <pre><code>import org.apache.spark.SparkContext
  import org.apache.spark.rdd._
  import org.apache.spark.mllib.clustering.GaussianMixture
  import org.apache.spark.mllib.linalg.{Vector, Vectors}
  
  def sparkContext: SparkContext = {
    import org.apache.spark.SparkConf
    new SparkContext(new SparkConf().setMaster("local[*]").setAppName("console"))
  }
  
  implicit val sc = sparkContext
  
  def observationsRdd(implicit sc: SparkContext): RDD[Vector] = {
    sc.textFile("observations.csv")
      .map { line =&gt; Vectors.dense(line.split(",").map { _.toDouble }) }
  }
  
  val gmm = {new GaussianMixture()
    .setK(6)
    .setMaxIterations(1000)
    .setConvergenceTol(0.001)
    .setSeed(1)
    .run(observationsRdd)}
  
  for (i &lt;- 0 until gmm.k) {
    println("weight=%f\nmu=%s\nsigma=\n%s\n" format
      (gmm.weights(i), gmm.gaussians(i).mu, gmm.gaussians(i).sigma))
  }
  </code></pre>
  
  <p>Truncated output:</p>
  
  <pre><code>weight=0.166667
  mu=[4730.358845338535,4391.695550847029,4072.3224046605947,4253.183898304653,4454.124682202946,4775.553442796136,4980.3952860164545,4812.717637711368,5120.44449152493,2820.1827330505857,180.10291313557565,4189.185858050445,3690.793644067457]
  sigma=
  422700.24745093845  382225.3248240414   398121.9356855869   ... (13 total)
  382225.3248240414   471186.33178427175  455777.0565262309   ...
  398121.9356855869   455777.0565262309   461210.0532084378   ...
  469361.3787142044   497432.39963363775  515341.1303306988   ...
  474369.6318494179   482754.83801426284  500047.5114985542   ...
  453832.62301188655  443147.58931290614  461017.7038258409   ...
  458641.51202210854  433511.1974652861   452015.6655154465   ...
  387980.29836054996  459673.3283909025   455118.78272128507  ...
  461724.87201332086  423688.91832506843  442649.18455604656  ...
  291940.48273324646  257309.1054220978   269116.23674394307  ...
  16289.3063964479    14790.06803739929   15387.484828872432  ...
  334045.5231910066   338403.3492767321   350531.7768916226   ...
  280036.0894114749   267624.69326772855  279651.401859903    ...
  
  weight=0.166667
  mu=[4730.358845338535,4391.695550847029,4072.3224046605947,4253.183898304653,4454.124682202946,4775.553442796136,4980.3952860164545,4812.717637711368,5120.44449152493,2820.1827330505857,180.10291313557565,4189.185858050445,3690.793644067457]
  sigma=
  422700.24745093845  382225.3248240414   398121.9356855869   ... (13 total)
  382225.3248240414   471186.33178427175  455777.0565262309   ...
  398121.9356855869   455777.0565262309   461210.0532084378   ...
  469361.3787142044   497432.39963363775  515341.1303306988   ...
  474369.6318494179   482754.83801426284  500047.5114985542   ...
  453832.62301188655  443147.58931290614  461017.7038258409   ...
  458641.51202210854  433511.1974652861   452015.6655154465   ...
  387980.29836054996  459673.3283909025   455118.78272128507  ...
  461724.87201332086  423688.91832506843  442649.18455604656  ...
  291940.48273324646  257309.1054220978   269116.23674394307  ...
  16289.3063964479    14790.06803739929   15387.484828872432  ...
  334045.5231910066   338403.3492767321   350531.7768916226   ...
  280036.0894114749   267624.69326772855  279651.401859903    ...
  
  weight=0.166667
  mu=[4730.358845338535,4391.695550847029,4072.3224046605947,4253.183898304653,4454.124682202946,4775.553442796136,4980.3952860164545,4812.717637711368,5120.44449152493,2820.1827330505857,180.10291313557565,4189.185858050445,3690.793644067457]
  sigma=
  422700.24745093845  382225.3248240414   398121.9356855869   ... (13 total)
  382225.3248240414   471186.33178427175  455777.0565262309   ...
  398121.9356855869   455777.0565262309   461210.0532084378   ...
  469361.3787142044   497432.39963363775  515341.1303306988   ...
  474369.6318494179   482754.83801426284  500047.5114985542   ...
  453832.62301188655  443147.58931290614  461017.7038258409   ...
  458641.51202210854  433511.1974652861   452015.6655154465   ...
  387980.29836054996  459673.3283909025   455118.78272128507  ...
  461724.87201332086  423688.91832506843  442649.18455604656  ...
  291940.48273324646  257309.1054220978   269116.23674394307  ...
  16289.3063964479    14790.06803739929   15387.484828872432  ...
  334045.5231910066   338403.3492767321   350531.7768916226   ...
  280036.0894114749   267624.69326772855  279651.401859903    ...
  
  weight=0.166667
  mu=[4730.358845338535,4391.695550847029,4072.3224046605947,4253.183898304653,4454.124682202946,4775.553442796136,4980.3952860164545,4812.717637711368,5120.44449152493,2820.1827330505857,180.10291313557565,4189.185858050445,3690.793644067457]
  sigma=
  422700.24745093845  382225.3248240414   398121.9356855869   ... (13 total)
  382225.3248240414   471186.33178427175  455777.0565262309   ...
  398121.9356855869   455777.0565262309   461210.0532084378   ...
  469361.3787142044   497432.39963363775  515341.1303306988   ...
  474369.6318494179   482754.83801426284  500047.5114985542   ...
  453832.62301188655  443147.58931290614  461017.7038258409   ...
  458641.51202210854  433511.1974652861   452015.6655154465   ...
  387980.29836054996  459673.3283909025   455118.78272128507  ...
  461724.87201332086  423688.91832506843  442649.18455604656  ...
  291940.48273324646  257309.1054220978   269116.23674394307  ...
  16289.3063964479    14790.06803739929   15387.484828872432  ...
  334045.5231910066   338403.3492767321   350531.7768916226   ...
  280036.0894114749   267624.69326772855  279651.401859903    ...
  
  weight=0.166667
  mu=[4730.358845338535,4391.695550847029,4072.3224046605947,4253.183898304653,4454.124682202946,4775.553442796136,4980.3952860164545,4812.717637711368,5120.44449152493,2820.1827330505857,180.10291313557565,4189.185858050445,3690.793644067457]
  sigma=
  422700.24745093845  382225.3248240414   398121.9356855869   ... (13 total)
  382225.3248240414   471186.33178427175  455777.0565262309   ...
  398121.9356855869   455777.0565262309   461210.0532084378   ...
  469361.3787142044   497432.39963363775  515341.1303306988   ...
  474369.6318494179   482754.83801426284  500047.5114985542   ...
  453832.62301188655  443147.58931290614  461017.7038258409   ...
  458641.51202210854  433511.1974652861   452015.6655154465   ...
  387980.29836054996  459673.3283909025   455118.78272128507  ...
  461724.87201332086  423688.91832506843  442649.18455604656  ...
  291940.48273324646  257309.1054220978   269116.23674394307  ...
  16289.3063964479    14790.06803739929   15387.484828872432  ...
  334045.5231910066   338403.3492767321   350531.7768916226   ...
  280036.0894114749   267624.69326772855  279651.401859903    ...
  
  weight=0.166667
  mu=[4730.358845338535,4391.695550847029,4072.3224046605947,4253.183898304653,4454.124682202946,4775.553442796136,4980.3952860164545,4812.717637711368,5120.44449152493,2820.1827330505857,180.10291313557565,4189.185858050445,3690.793644067457]
  sigma=
  422700.24745093845  382225.3248240414   398121.9356855869   ... (13 total)
  382225.3248240414   471186.33178427175  455777.0565262309   ...
  398121.9356855869   455777.0565262309   461210.0532084378   ...
  469361.3787142044   497432.39963363775  515341.1303306988   ...
  474369.6318494179   482754.83801426284  500047.5114985542   ...
  453832.62301188655  443147.58931290614  461017.7038258409   ...
  458641.51202210854  433511.1974652861   452015.6655154465   ...
  387980.29836054996  459673.3283909025   455118.78272128507  ...
  461724.87201332086  423688.91832506843  442649.18455604656  ...
  291940.48273324646  257309.1054220978   269116.23674394307  ...
  16289.3063964479    14790.06803739929   15387.484828872432  ...
  334045.5231910066   338403.3492767321   350531.7768916226   ...
  280036.0894114749   267624.69326772855  279651.401859903    ...
  </code></pre>
  
  <p>...</p>
  
  <p>Additionally, the code, input data, and output data is available as a gist @ <a href="https://gist.github.com/aaron-santos/91b4931a446c460e082b2b3055b9950f" rel="nofollow">https://gist.github.com/aaron-santos/91b4931a446c460e082b2b3055b9950f</a></p>
  
  <p>Thank you</p>