I'm new to machine learning domain. I want to build a Classification tree for Binary classification of data.

I have a training data set of 269 records out of which 56 records belong to 'yes' class and 213 records to 'no' class.

Is this data imbalanced for building CART model? Do I need to undersample 'no' class records? Also from Gini index, Chi-Square and Information Gain, which algorithm is best for node splitting?

P.S.:- I can't increase the size of the dataset further.


1 Answer 1


Yes, your data is not balanced.

Before applying any kind of modeling it is suggestible to balance the data, you can use packages like SMOTE,ROSE to overcome the imbalance in your data.

For your next question, which index to use: It is subjective to your data. Please go through these links Link-1, Link-2 for better understanding but suggestible to try both Entropy and Gini Impurity. There is a good chance to get similar trees and similar outcome.

Gain Ratio works better to reduce bias towards highly branching features like time, salary etc. (Information about the features of the dataset isn’t mentioned)

Do let me know if you have any additional questions.

Finally, how big is your test dataset?

  • $\begingroup$ Thank you for answering the question. I will try to balance data. Can you tell me the minimum ratio of yes to no class where we can say the data is balanced enough? Actually, I used same data for naive Bayesian classifier which gave me 86% accuracy. That's why I ignored balancing in first place. $\endgroup$
    – Scorpionk
    Jan 16, 2018 at 12:36
  • 1
    $\begingroup$ 50% yes and 50% no is called as balanced data. Even NB might give you good result but it is not standard or fixed but it is important to balance the data. $\endgroup$
    – Toros91
    Jan 16, 2018 at 12:46
  • $\begingroup$ My test data set is very small. only 35 records are there. What your thoughts on it? $\endgroup$
    – Scorpionk
    Jan 20, 2018 at 9:23
  • $\begingroup$ It all depends on your training set not on test set. You use test set to access the models accuracy and its performance. $\endgroup$
    – Toros91
    Jan 20, 2018 at 9:32
  • 1
    $\begingroup$ Yeah I think you can comment here. If necessary we can even make a private chat group. 🙂 $\endgroup$
    – Toros91
    Jan 20, 2018 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.