title: Why am I getting different scores on training data?
body: <p>I am trying to build an optimized SVM classification model using scikit-learn and I am fairly new in Python, not really in ML in general. Here's the code I am using:</p>
  <pre><code># Training the SVM model on the Training set
  from sklearn.svm import SVC
  classifier = SVC()
  
  # define evaluation
  cv = RepeatedStratifiedKFold(n_splits=10, n_repeats=5, random_state=1)
  # define search space
  space = dict()
  space['kernel'] = [&quot;linear&quot;, &quot;rbf&quot;, &quot;sigmoid&quot;, &quot;poly&quot;]
  space['C'] = [0.1, 1, 10, 100, 1000]
  space['gamma'] = [1, 0.1, 0.01, 0.001, 0.0001]
  space['tol'] = [1e-3, 1e-4, 1e-5, 1e-6]
  
  # define search
  search = RandomizedSearchCV(classifier, space, n_iter=500, scoring='accuracy', n_jobs=-1, cv=cv, random_state=1)
  
  # execute search
  result = search.fit(X_train, y_train)
  
  # summarize result
  print('Best Score: %s' % result.best_score_)
  print('Best Hyperparameters: %s' % result.best_params_)
  bestModel = result.best_estimator_
  
  #Test
  a = X_train
  b = y_train
  grid_predictions = bestModel.predict(a)
  accuracy_score(b, grid_predictions)
  </code></pre>
  <p>I am trying to get how well my training data is classified. My question is: Why I am getting different accuracy outputs from <code>result.best_score_</code> (which is the best search model's accuracy) and <code>accuracy_score(b, grid_predictions)</code> (which is where the exact training data is fed to the model with best performance)?</p>