powered by
k_fold_cross splits the dataset into k parts, and uses k-1 parts to train the model and the remaining part to test the model.
k_fold_cross(data,k)
a list with two sublists: training set and test set
dataset which will be used for K-Fols Cross Validation
integer
df = data.frame("hours"=c(1, 2, 4, 5, 5, 6, 6, 7, 8, 10, 11, 11, 12, 12, 14), "score"=c(64, 66, 76, 73, 74, 81, 83, 82, 80, 88, 84, 82, 91, 93, 89)) k_fold_cross(df,k=2)
Run the code above in your browser using DataLab