This commit is contained in:
Morten Hjorth-Jensen
2021-11-11 07:29:34 +01:00
parent e3d9a18a2a
commit 0bf62ad3f5
82 changed files with 20388 additions and 25737 deletions
+57 -2
View File
@@ -440,7 +440,7 @@ s = -\sum_{k=1}^K p_{mk}\log{p_{mk}}.
!split
===== Gini Index?Coefficient/Impurity =====
===== Gini Index (or Coefficient or Impurity) =====
The Gini index $g$ gives us the degree of probability of a specific
variable that is wrongly classified.
@@ -453,7 +453,7 @@ o A value $g=0.5$ means that the elements in a node are uniformly distributed a
It favors binary splitting.
!split
===== Why binary split? =====
===== Why binary splits? =====
It is custom to split to a tree uising binary splits. The reason is
that multiway splits fragment the data too quickly, leaving
@@ -461,6 +461,61 @@ insufficient data at the next level down. Multiway splits can be
achieved by a series of binary split and this is normally preferred.
!split
===== Computing a Tree using the Gini Index =====
Consider the following example with attributes/features and two
possible outcomes (classes) for each attribute. Assume we wish to find some
correlations between the average grade of a student as function of the
number of hours studied and hours slept. We want also to correlate the
grade in a given course with the general trend, whether the students
recently has gotten grades below average or above.
We have three features/attributes
o Trend of average grades before present course, classified as either below or above the average grade of the whole class
o The number of hours studies, classified again as either higher (more than 3 hours per day) or lower . Here we have used a standard for one $ECTS$ which is scaled to 25-30 hours of work for a semester which lasts 18 weeks, with 15 weeks of lectures and 3 weeks for exams, assuming a total of 30 ECTS per semester.
o The number of hours slept as high for more than $8$ hours and below for less than 8 hours of sleep, classified again as either high or low
o The final grade whether it is above or below average
!split
===== The Table =====
|---------------------------------------------------|
| Grade Trend | Hours slept | Hours Studied | Grade |
|---------------------------------------------------|
!split
===== Computing the various Gini Indices =====
In computations we will translate all classes into numbers. Being
these binary classes, they can easily be split into ones and zeros.
!bblock Gini index for Average trend
!eblock
!split
===== Computing the various Gini Indices, Hours slept =====
!bblock Gini index for hour slept
!eblock
!split
===== Computing the various Gini Indices, Hours studied =====
!bblock Gini index for hour studied
!eblock
!split