I am having a hard time understanding the results of a cross validation test and a test run on a test set.
First I made the following pipeline:
pipe=Pipeline([('clf',DecisionTreeClassifier(random_state=0))])
Then I use cross validation on a scaled training set(75% of the original dataset):
>>> cross_val_score(pipe, X_train_scaled,Y_train,cv=7).mean()
0.7257796129913106
I then fit the pipeline with the training data and run the classifier on the training data.
>>> pipe.fit(X_train_scaled,Y_train)
>>> pipe.score(X_train_scaled,Y_train)
0.7734339749126584
Finally, I checked the models performance on the test set:
pipe.score(X_test_scaled, Y_test)
0.941353836876225
Question 1: have I done the right steps, do I even need to run the pipeline on the training data for the training data score?
Question 2: why is the test data so much more accurate than the cross validated one. Is the data underfitted, or is it okay for this to happen ?