title: Spark K-Means get original Cluster Center / Centroids with Normalization
body: <p>I ran a k-means model    </p>
  
  <pre><code>val kmeans = new KMeans().setK(k).setSeed(1L)
  val model = kmeans.fit(train_dataset)
  </code></pre>
  
  <p>and then extract the cluster centers (centroids)</p>
  
  <pre><code> var clusterCenters:Seq[(Double,Double,Double,Double,Double,Double,Double,Double,Double)] = Seq()
  for(e &lt;- model.clusterCenters){
    clusterCenters = clusterCenters :+ ((e(0)),e(1),e(2),e(3),e(4),e(5),e(6),e(7),e(8))
  }
  
  import sc.implicits._
  var centroidsDF = clusterCenters.toDF()
  </code></pre>
  
  <p>to write the results back I create a DataFrame of the resulting cluster centers.</p>
  
  <p>Now I have the problem that I have normalized the data beforehand to improve the clustering results. </p>
  
  <pre><code> val scaler = new StandardScaler()
        .setInputCol("features")
        .setOutputCol("scaledFeatures")
        .setWithStd(true)
        .setWithMean(false)
      scalerModel = scaler.fit(train_dataset)
      scaledData = scalerModel.transform(train_dataset)
  </code></pre>
  
  <p>How can I get the centroids in its original form de-normalized?</p>