Continuing from our previous post at:
Q. What is a Claassification?
A. Clasification is putting into categories. Pass-Fail, First Division-Second Division-Third Division etc
Q. What is a Decision Tree?
A. A Decision Tree is a multilevel classifier, much like a grid of roads where you take a turn at every junction. It has a hierarchical structure like a tree with a root and many branches.
Here is the simple data that we used for training the classifier
phy=[40,40,40,39] chem=[40,39,40,40] maths=[40,40,39,40] result=["Pass","Fail","Fail","Fail"] status = [1,0,0,0] This is a set of four results in 3 subjects Physics, Chemistry and Maths. Anyone getting less than 40 in any subject is failed. Pass is 1 and fail is 0.
Here is the trained classifier.
First of all what is Gini?
Where x is the number of +ve answers pass , n is the number of samples, and y is the number of -ve answers fail.
In our case n=4, x=1,y=3
= 1-(1/16 + 9/16)
=1-0.625
0.375
The first division has been done at <=39.5, meaning <=39.5 is fail. No of samples is 4, 1 goes the fail way and 3 goes the pass way. The 3 pass are then evaluated at the next step.
We will try multi-feature and multi-output classification next.
Thanks for reading.🙂
The code on Colab is at