- split your dataset into the y=0 set and the y = 1 set
- do the 80/20 training/test split on the y=0 and y=1 separately
- combine the two training sets and the two test sets
Random Test Dataset With More Values Of One Type
1 次查看(过去 30 天)
显示 更早的评论
I have a set with y values of 0 or 1.
most of my data has 0 value, so when splitting the data to train and test 80 -20 respectively, most of the test data has 0 y value.
I want that the randomly chosen test data will have more data with 1 has y vlaues, how can it be done?
0 个评论
回答(1 个)
the cyclist
2019-5-22
One simple approach would be:
Bear in mind that highly imbalanced datasets like this have pitfalls for analysis. It's too much to describe here, but if you search keywords like imbalanced dataset machine learning, you'll be able to read about the problems, and some potential solutions.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!