Could someone please validate the algorithm for 10 fold cross validation?
I do not want to use the cut function as I thought of this intuition
1) Find length of the dataframe, n.
2) No: instances in test set size = floor(n/10)
3) loop over i from 1:10
4) Create folds by taking the indices;
a) indices=1:size
of the data frame for first fold
b) indices=((i - 1) * size + 1):(i * size)
for all the other folds except the 10th
c) indices=((i - 1) * size + 1):(n)
for the 10th fold
test=df[indices,]
train=df[-indices,]
5) Train the model and find the MSE for each fold.