Data Science (Python) :: Decision Tree Classification & Random Forest Classification

Sunil Kumar SV
Jul 24, 2017 · 1 min read

Intention of this post is to give a quick refresher (thus, it’s assumed that you are already familiar with the stuff) of concept of “Decision Tree Classification & Random Forest Classification” (using Python). You can treat this as FAQ’s as well.

Sample code for implementing Decision Tree Classification?

from sklearn.tree import DecisionTreeClassifier
classifier = DecisionTreeClassifier(criterion = ‘entropy’, random_state = 0)
classifier.fit(X_train, y_train)

***************************************

Sample code for implementing Random Forest Classification?

from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(n_estimators = 10, criterion = ‘entropy’, random_state = 0)
classifier.fit(X_train, y_train)

***************************************

How is decision tree & random forest classification implementation for classification problems differ to the implementation for regression problems?

Pragmatically, no much difference actual. Both ways of applying the algorithm is almost same!

**************************************

Next :- Data Science :: Performance of Each Classification Model

Prev :: Data Science (Python) :: Naive Bayes

If you liked this article, please hit the ❤ icon below

Sunil Kumar SV

Written by

#ProductManager #TechEnthusiast #DataScienceEnthusiast #LoveToSolveProblemsUsingTech #Innovation

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade