Discover more from Daily Dose of Data Science
A Typical Thing About Decision Trees Which Many Often Ignore
Overfitting = Terror!
Although decision trees are simple and intuitive, they always need a bit of extra caution. Here's what you should always remember while training them.
In sklearn's implementation, by default, a decision tree is allowed to grow until all leaves are pure. This leads to overfitting as the model attempts to classify every sample in the training set.
There are various techniques to avoid this, such as pruning and ensembling. Also, make sure that you tune hyperparameters if you use sklearn's implementation.
This was a gentle reminder as many of us often tend to use sklearn’s implementations in their default configuration.
It is always a good practice to know what a default implementation is hiding underneath.
Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new about Python and Data Science every day.
👉 If you liked this post, leave a heart react 🤍.
👉 If you love reading this newsletter, feel free to share it with friends!
Find the code for my tips here: GitHub.