Asked about When one class is rare
Should you oversample before or after splitting?
An answer that works
After, and only the training fold. Oversampling before splitting puts copies of the same example in both train and test, which inflates the score. The validation set must keep the real class balance.
Reading an answer is not being able to give one. The section that teaches this is When one class is rare, 5 hours of Imbalanced and messy data.
Learn this properly