title: Dimension of data before and after performing PCA
body: <p>I'm attempting <a href="http://www.kaggle.com/c/digit-recognizer" rel="nofollow">kaggle.com's digit recognizer competition</a> using Python and scikit-learn.</p>
  
  <p>After removing labels from the training data, I add each row in CSV into a list like this:</p>
  
  <pre><code>for row in csv:
      train_data.append(np.array(np.int64(row)))
  </code></pre>
  
  <p>I do the same for the test data.</p>
  
  <p>I pre-process this data with PCA in order to perform dimension reduction (and feature extraction?):</p>
  
  <pre><code>def preprocess(train_data, test_data, pca_components=100):
      # convert to matrix
      train_data = np.mat(train_data)
  
      # reduce both train and test data
      pca = decomposition.PCA(n_components=pca_components).fit(train_data)
      X_train = pca.transform(train_data)
      X_test = pca.transform(test_data)
  
      return (X_train, X_test)
  </code></pre>
  
  <p>I then create a kNN classifier and fit it with the <code>X_train</code> data and make predictions using the <code>X_test</code> data.</p>
  
  <p>Using this method I can get around 97% accuracy.</p>
  
  <p>My question is about the dimensionality of the data before and after PCA is performed</p>
  
  <p>What are the dimensions of <code>train_data</code> and <code>X_train</code>?</p>
  
  <p>How does the number of components influence the dimensionality of the output? Are they the same thing?</p>