Sample grouping

actually i couldn’t get the concept of sample grouping
i need more clarification about this concept, why we use it , and what is the problem if we didn’t use it

If you do not use group-wise cross-validation, then the cross-validation error you measure does not necessarily reflect the ability of the model to generalize (get low prediction error) on new groups.

Since it’s often the case that we want to have a model to generalize to new groups not represented in the training set, it’s important to measure this ability directly using group-aware CV.