I have data with binary response (default of a client). I want to split the data into training and testing sets. I have 300 default clients and 700 non default clients. When splitting, should I make sure that the training set keeps the same ratio 3:7 of defaults? Or can I simply take a random sample?
Yes, you can take a random sample.
As the difference between the two types is significant, a random sample would obey(almost) the same distribution.
You might want to read up on random sampling, for appreciating the concept and executing it with confidence.
If you want to be sure to keep a perfect ratio without introducing a selection bias, you could select respectively all the
1 values, sample it and select the quantity you want and do the same with the
The ultimate question would be, what do you plan to do with your data once you've done the split ?