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.

๐Ÿ‘‰ Read what others are saying about this post on LinkedIn and Twitter.

๐Ÿ‘‰ 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.

I like to explore, experiment and write about data science concepts and tools. You can connect with me on LinkedIn and Twitter.

Reply

or to participate.