I want to do a prediction using k-fold cross validation and, in the end, store all the predictions in a file.
I am able to do a prediction and get the accuracy, this is how I did it:
cv1 = RepeatedKFold(n_splits=10, n_repeats=3, random_state=1)
model = LogisticRegression()
scores = cross_val_score(model, X, y, scoring='accuracy', cv=cv1, n_jobs=-1)
print('Accuracy: %.3f (%.3f)' % (mean(scores), std(scores)))
But I do not find any way or function that allows me to access the actual predictions. In the end, I want to get an output containing each data point's id and the predicted label.
I tried to find a way to access the predictions using
cross_val_predict(model, X, y, cv=cv1, method='predict')
but this function does not work when using RepeatedKFold
cross validation.