Please, could you advise me the best Python library for the following problem. I have 60 binary input variables and a binary output variable. There are 10 000 – 20 000 training examples. I want to build decision tree to predict output variable. My requirements:

  1. I can set minimum number of elements in each leave (to avoid overfitting)
  2. Method should give as “clean” leaves as possible (considering first constraint)
  3. Method should be as fast as possible (ideally I can specify maximum time and method must give the best result for this time)

I don’t want to use training and test set (all samples are training).

My questions are:

  1. What is the best Python library for my problem
  2. According to you experience, how much time does it take to build rather "good" tree in my conditions (processor Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz 2.11 GHz)
  • 2
    $\begingroup$ Welcome to DataScienceSE. you should probably try with the standard sklearn library imho, but I don't know if there are better options given your constraints. Afaik the training time should be fairly short, but I doubt it's possible for a decision tree to be interrupted (ideal point 3). Every possible implementation allows feeding a training set, it's never mandatory to split the dataset. But don't forget that you will probably need to evaluate your model. $\endgroup$
    – Erwan
    Jul 24, 2022 at 13:48
  • $\begingroup$ Welcome to DSSE; please avoid asking for the "best" anything, since it can (and probably will) be interpreted as an opinion-based question, and it will be closed as such. $\endgroup$
    – desertnaut
    Jul 25, 2022 at 14:03

1 Answer 1

  1. Why don't you start with sklearn. You can set
  • maximum number of elements in leaf
  • Minimum element at root
  1. Decision Tree takes batch algorithm. You can input 20k samples all at once. The CPU config you mentioned should be able to handle.

Decision Tree are prone to overfit. So it is better to leave some test data.


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.