title: Pyspark and PCA: How can I extract the eigenvectors of this PCA? How can I calculate how much variance they are explaining?
body: <p>I am reducing the dimensionality of a <code>Spark DataFrame</code> with <code>PCA</code> model with pyspark (using the <code>spark</code> <code>ml</code> library) as follows:</p>
  <pre><code>pca = PCA(k=3, inputCol=&quot;features&quot;, outputCol=&quot;pca_features&quot;)
  model = pca.fit(data)
  </code></pre>
  <p>where <code>data</code> is a <code>Spark DataFrame</code> with one column labeled <code>features</code> which is a <code>DenseVector</code> of 3 dimensions:</p>
  <pre><code>data.take(1)
  Row(features=DenseVector([0.4536,-0.43218, 0.9876]), label=u'class1')
  </code></pre>
  <p>After fitting, I transform the data:</p>
  <pre><code>transformed = model.transform(data)
  transformed.first()
  Row(features=DenseVector([0.4536,-0.43218, 0.9876]), label=u'class1', pca_features=DenseVector([-0.33256, 0.8668, 0.625]))
  </code></pre>
  <p>How can I extract the eigenvectors of this PCA? How can I calculate how much variance they are explaining?</p>