วันศุกร์ที่ 9 พฤศจิกายน พ.ศ. 2561

Imbalanced data set

  • A problem in classification i.e. labels are discrete 
  • Binary class data set is imbalanced if  YES and NO classes (i.e., the labels of data points in the set) are not 50/50 (or 60/40) in terms of the number of data points. 
  •  A dataset is marginally imbalanced if one class is rare compared to the other class.
  • If the training set has a heavy imbalance where most labels are "man" rather than "woman," the model will generally predict "man" more frequently. This scenario has two problems: 1.Biased Decision Boundaries: The model's optimization algorithm shifts its internal boundary because minimizing errors on the majority class ("man") lowers the overall loss much faster than trying to get the minority class right. 2.Skewed Output Probabilities: The model learns the prior probabilities of the training data. Because "man" appears much more frequently, the model's output probabilities naturally favor it, requiring an unusually high amount of evidence for it to output "woman."
  • Solved by under sampling  (i.e. use all the smaller class and randomly select same number of majority class several times to make multiple data sets and then combine all classification results) to balance it this is best way for this without loosing information. If you use boosting you could alter the weights and balance data that way (https://www.researchgate.net/post/How_to_know_that_our_dataset_is_imbalance). อีกวิธีที่นิยมใช้แก้ปัญหาชื่อ SMOTE ซึ่งเป็นการสร้าง synthetic samples (i.e. oversampling) ขึ้นมา https://towardsdatascience.com/dealing-with-imbalanced-classes-in-machine-learning-d43d6fa19d2
  • สมมติให้ data set มี 2 classes Class A มีจำนวน 90 เปอร์เซ็นต์ Class B มีจำนวน 10 เปอร์เซ็นต์ ถ้าไม่แก้ปัญหา imbalance แล้วใช้วิธีแล้วใช้วิธี Random ให้ 90%  อยู่ใน A จะได้ accuracy 91% แต่ถ้าพยากรณ์ถูกหมดทั้ง A & B (อาจใช้over/undersampling ช่วย) จะได้ accuracy 100%