Department of Electronics & Telecommunications Engineering: ETEL71A-Machine Learning and AI
Department of Electronics & Telecommunications Engineering: ETEL71A-Machine Learning and AI
Engineering
ETEL71A-Machine Learning and AI
Class: BE
Name : Adya Kastwar
UID: 2016120024
Sem: VII
Experiment: Decision Tree (ID3) algorithm
Objective: Write Python program to demonstrate the working of the decision tree based ID3
algorithm by using appropriate data set for building the decision tree and apply this
knowledge to classify a new sample.
Outcomes:
1. Find entropy of data and follow steps of the algorithm to construct a tree.
2. Representation of hypothesis using decision tree.
3. Apply Decision Tree algorithm to classify the given data.
4. Interpret the output of Decision Tree.
System Requirements:
Linux OS with Python and libraries or R or windows with MATLAB
#Feature scaling so as to bring values of attributes to the same scale to avoid errors
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)
Output :
Conclusion:
High accuracy of classification was obtained using decision tree based on entropy.
As the number of examples increased from 80 to 400, the prediction accuracy increased
greatly.