I have a dataset that I spilt by the holdout method using sklearn. The following is the procedure
from sklearn.model_selection import train_test_split
(X_train, X_test, y_train, y_test)=train_test_split(X,y,test_size=0.3, stratify=y)
I am using Random forest as classifier. The following is the code for that
clf = RandomForestClassifier(random_state=0 )
clf.fit(X_train, y_train)
R_y_pred = clf.predict(X_test)
target_names = ['Alive', 'Dead']
print(classification_report(y_test, R_y_pred, target_names=target_names))
Now I would like to use stratified kfold cross-validation on the training set. The code that I have written for that
cv_results = cross_validate(clf, X_train, y_train, cv=5)
R_y_pred = cv_results.predict(X_test)
target_names = ['Alive', 'Dead']
print(classification_report(y_test, R_y_pred, target_names=target_names))
I got error as cv_results has no attribute like predict.
I would like to know how could I print the classification result after using k fold cross validation.
Thank you.