I am following the IRIS example of tensorflow.
My case now is I have all data in a single CSV file, not separated, and I want to apply k-fold cross validation on that da
NN's are usually used with large datasets where CV is not used - and very expensive. In the case of IRIS (50 samples for each species), you probably need it.. why not use scikit-learn with different random seeds to split your training and testing?
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
for k in kfold:
If you dont like the random seed and want a more structured k-fold split, you can use this taken from here.
from sklearn.model_selection import KFold, cross_val_score
X = ["a", "a", "b", "c", "c", "c"]
k_fold = KFold(n_splits=3)
for train_indices, test_indices in k_fold.split(X):
print('Train: %s | test: %s' % (train_indices, test_indices))
Train: [2 3 4 5] | test: [0 1]
Train: [0 1 4 5] | test: [2 3]
Train: [0 1 2 3] | test: [4 5]