title: Obtain eigen values and vectors from sklearn PCA
body: <p>How I can get the the eigen values and eigen vectors of the PCA application? </p>
  
  <pre><code>from sklearn.decomposition import PCA
  clf=PCA(0.98,whiten=True)      #converse 98% variance
  X_train=clf.fit_transform(X_train)
  X_test=clf.transform(X_test)
  </code></pre>
  
  <p>I can't find it in <a href="http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html#sklearn.decomposition.PCA.get_precision" rel="noreferrer">docs</a>.</p>
  
  <p>1.I am "not" able to comprehend the different results here.</p>
  
  <p><strong>Edit</strong>:</p>
  
  <pre><code>def pca_code(data):
      #raw_implementation
      var_per=.98
      data-=np.mean(data, axis=0)
      data/=np.std(data, axis=0)
      cov_mat=np.cov(data, rowvar=False)
      evals, evecs = np.linalg.eigh(cov_mat)
      idx = np.argsort(evals)[::-1]
      evecs = evecs[:,idx]
      evals = evals[idx]
      variance_retained=np.cumsum(evals)/np.sum(evals)
      index=np.argmax(variance_retained&gt;=var_per)
      evecs = evecs[:,:index+1]
      reduced_data=np.dot(evecs.T, data.T).T
      print(evals)
      print("_"*30)
      print(evecs)
      print("_"*30)
      #using scipy package
      clf=PCA(var_per)
      X_train=data.T
      X_train=clf.fit_transform(X_train)
      print(clf.explained_variance_)
      print("_"*30)
      print(clf.components_)
      print("__"*30)
  </code></pre>
  
  <ol start="2">
  <li>I wish to obtain all the eigenvalues and eigenvectors instead of just the reduced set with the convergence condition.</li>
  </ol>