title: KFolds Cross Validation vs train_test_split
body: <p>I just built my first <code>random forest classifier</code> today and I am trying to improve its performance. I was reading about how <code>cross-validation</code> is important to avoid <code>overfitting</code> of data and hence obtain better results. I implemented <code>StratifiedKFold</code> using <code>sklearn</code>, however, surprisingly this approach resulted to be less accurate. I have read numerous posts suggesting that <code>cross-validating</code> is much more efficient than <code>train_test_split</code>.</p>
  
  <p><strong>Estimator:</strong></p>
  
  <pre><code>rf = RandomForestClassifier(n_estimators=100, random_state=42)
  </code></pre>
  
  <p><strong>K-Fold:</strong></p>
  
  <pre><code>ss = StratifiedKFold(n_splits=10, shuffle=True, random_state=42)
  for train_index, test_index in ss.split(features, labels):
      train_features, test_features = features[train_index], features[test_index]
      train_labels, test_labels = labels[train_index], labels[test_index]
  </code></pre>
  
  <p><strong>TTS:</strong></p>
  
  <pre><code>train_feature, test_feature, train_label, test_label = \
      train_test_split(features, labels, train_size=0.8, test_size=0.2, random_state=42)
  </code></pre>
  
  <p><strong>Below are results:</strong></p>
  
  <p><strong>CV:</strong></p>
  
  <pre><code>AUROC:  0.74
  Accuracy Score:  74.74 %.
  Specificity:  0.69
  Precision:  0.75
  Sensitivity:  0.79
  Matthews correlation coefficient (MCC):  0.49
  F1 Score:  0.77
  </code></pre>
  
  <p><strong>TTS:</strong></p>
  
  <pre><code>AUROC:  0.76
  Accuracy Score:  76.23 %.
  Specificity:  0.77
  Precision:  0.79
  Sensitivity:  0.76
  Matthews correlation coefficient (MCC):  0.52
  F1 Score:  0.77
  </code></pre>
  
  <p>Is this actually possible? Or have I wrongly set up my models?</p>
  
  <p>Also, is this the correct way of using cross-validation? </p>