title: Does the pipeline object in sklearn transform the test data when using the .predict() method?
body: <p>When I use a pipeline object,</p>
  <ol>
  <li><p>Does the pipeline object fit <strong>and transform</strong> the train data when I use the <code>.fit()</code> method? Or should I use the <code>.fit_transform()</code> method? What is the difference between the two?</p>
  </li>
  <li><p>When I use the <code>.predict()</code> method on the test data, does the pipeline object <strong>transform the test data and only then predict it?</strong> That is, should I  transform the test data using the <code>.transform()</code> method before I use the <code>.predict()</code> method?</p>
  </li>
  </ol>
  <p>This is the code I have:</p>
  <pre><code>import pandas as pd
  import numpy as np
  from sklearn.model_selection import train_test_split
  from sklearn.feature_selection import SelectKBest, f_classif
  from sklearn.decomposition import PCA
  from sklearn.tree import DecisionTreeClassifier
  
  
  
  #creating some data
  X, y = np.ones((50, 1)), np.hstack(([0] * 45, [1] * 5))
  
  #creating the pipeline
  steps = [('scaler', StandardScaler()), ('SelectKBest', SelectKBest(f_classif, k=3)), ('pca', PCA(n_components=2)), ('DT', DecisionTreeClassifier(random_state=0))]
  model = Pipeline(steps=steps)
  
  #splitting the data
  X_train, X_test, y_train, y_test = train_test_split(
      X, y, test_size=0.33, random_state=42)
  
  model.fit(X_train,y_train)
  
  model.predict(X_test)
  </code></pre>