Home Decision Tree Classification
Post
Cancel

Decision Tree Classification

What is Decision Tree Classification?

It’s basic algorithm is the same as Decision Tree Regression.
The difference can be seen in the image below.

Decision Tree Classification


Decision Tree Regression



Example



Code



1
2
3
4
5
6
7
8
9
10
11
from sklearn.tree import DecisionTreeClassifier
from sklearn.preprocessing import StandardScaler

sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

classifier = DecisionTreeClassifier(criterion = 'entropy', random_state = 0)
classifier.fit(X_train, y_train)

y_pred = classifier.predict(X_test)



Result







Implementation

This post is licensed under CC BY 4.0 by the author.