My data has class imbalance-- that is, some classes have significantly fewer training samples than the others. I want to perform a train-validation split in such as way that the class ratios are preserved in both the training dataset as well as the validation dataset.
I tried looking for inbuilt functions that help me do so, but haven't been successful. Suggestions of any inbuilt functions (I might have overlooked some in my search) or a standard procedure to do so would be welcome.
PS: I am not doing Cross Validation. Just a normal 80/20 split.