<s>
In	O
information	O
theory	O
and	O
machine	O
learning	O
,	O
information	B-Algorithm
gain	I-Algorithm
is	O
a	O
synonym	O
for	O
Kullback	O
–	O
Leibler	O
divergence	O
;	O
the	O
amount	O
of	O
information	O
gained	O
about	O
a	O
random	O
variable	O
or	O
signal	O
from	O
observing	O
another	O
random	O
variable	O
.	O
</s>
<s>
However	O
,	O
in	O
the	O
context	O
of	O
decision	B-Algorithm
trees	I-Algorithm
,	O
the	O
term	O
is	O
sometimes	O
used	O
synonymously	O
with	O
mutual	O
information	O
,	O
which	O
is	O
the	O
conditional	O
expected	O
value	O
of	O
the	O
Kullback	O
–	O
Leibler	O
divergence	O
of	O
the	O
univariate	O
probability	O
distribution	O
of	O
one	O
variable	O
from	O
the	O
conditional	O
distribution	O
of	O
this	O
variable	O
given	O
the	O
other	O
one	O
.	O
</s>
<s>
The	O
information	B-Algorithm
gain	I-Algorithm
of	O
a	O
random	O
variable	O
X	O
obtained	O
from	O
an	O
observation	O
of	O
a	O
random	O
variable	O
A	O
taking	O
value	O
is	O
defined	O
the	O
Kullback	O
–	O
Leibler	O
divergence	O
of	O
the	O
prior	O
distribution	O
for	O
x	O
from	O
the	O
posterior	O
distribution	O
for	O
x	O
given	O
a	O
.	O
</s>
<s>
The	O
expected	O
value	O
of	O
the	O
information	B-Algorithm
gain	I-Algorithm
is	O
the	O
mutual	O
information	O
of	O
X	O
and	O
A	O
–	O
i.e.	O
</s>
<s>
Such	O
a	O
sequence	O
(	O
which	O
depends	O
on	O
the	O
outcome	O
of	O
the	O
investigation	O
of	O
previous	O
attributes	O
at	O
each	O
stage	O
)	O
is	O
called	O
a	O
decision	B-Algorithm
tree	I-Algorithm
and	O
applied	O
in	O
the	O
area	O
of	O
machine	O
learning	O
known	O
as	O
decision	B-Algorithm
tree	I-Algorithm
learning	I-Algorithm
.	O
</s>
<s>
Usually	O
an	O
attribute	B-Algorithm
with	O
high	O
mutual	O
information	O
should	O
be	O
preferred	O
to	O
other	O
attributes	O
.	O
</s>
<s>
In	O
general	O
terms	O
,	O
the	O
expected	O
information	B-Algorithm
gain	I-Algorithm
is	O
the	O
reduction	O
in	O
information	O
entropy	O
from	O
a	O
prior	O
state	O
to	O
a	O
state	O
that	O
takes	O
some	O
information	O
as	O
given	O
:	O
</s>
<s>
where	O
is	O
the	O
conditional	O
entropy	O
of	O
given	O
the	O
value	O
of	O
attribute	B-Algorithm
.	O
</s>
<s>
Let	O
denote	O
a	O
set	O
of	O
training	O
examples	O
,	O
each	O
of	O
the	O
form	O
where	O
is	O
the	O
value	O
of	O
the	O
attribute	B-Algorithm
or	O
feature	B-Algorithm
of	O
example	B-Algorithm
and	O
is	O
the	O
corresponding	O
class	O
label	O
.	O
</s>
<s>
The	O
information	B-Algorithm
gain	I-Algorithm
for	O
an	O
attribute	B-Algorithm
is	O
defined	O
in	O
terms	O
of	O
Shannon	O
entropy	O
as	O
follows	O
.	O
</s>
<s>
For	O
a	O
value	O
taken	O
by	O
attribute	B-Algorithm
,	O
let	O
be	O
defined	O
as	O
the	O
set	O
of	O
training	O
inputs	O
of	O
for	O
which	O
attribute	B-Algorithm
is	O
equal	O
to	O
.	O
</s>
<s>
Then	O
the	O
information	B-Algorithm
gain	I-Algorithm
of	O
for	O
attribute	B-Algorithm
is	O
the	O
difference	O
between	O
the	O
a	O
priori	O
Shannon	O
entropy	O
of	O
the	O
training	O
set	O
and	O
the	O
conditional	O
entropy	O
.	O
</s>
<s>
The	O
mutual	O
information	O
is	O
equal	O
to	O
the	O
total	O
entropy	O
for	O
an	O
attribute	B-Algorithm
if	O
for	O
each	O
of	O
the	O
attribute	B-Algorithm
values	O
a	O
unique	O
classification	B-General_Concept
can	O
be	O
made	O
for	O
the	O
result	O
attribute	B-Algorithm
.	O
</s>
<s>
In	O
particular	O
,	O
the	O
values	O
defines	O
a	O
partition	O
of	O
the	O
training	O
set	O
data	O
into	O
mutually	B-Algorithm
exclusive	I-Algorithm
and	O
all-inclusive	O
subsets	O
,	O
inducing	O
a	O
categorical	O
probability	O
distribution	O
on	O
the	O
values	O
of	O
attribute	B-Algorithm
.	O
</s>
<s>
In	O
this	O
representation	O
,	O
the	O
information	B-Algorithm
gain	I-Algorithm
of	O
given	O
can	O
be	O
defined	O
as	O
the	O
difference	O
between	O
the	O
unconditional	O
Shannon	O
entropy	O
of	O
and	O
the	O
expected	O
entropy	O
of	O
conditioned	O
on	O
,	O
where	O
the	O
expectation	O
value	O
is	O
taken	O
with	O
respect	O
to	O
the	O
induced	O
distribution	O
on	O
the	O
values	O
of	O
.	O
</s>
<s>
For	O
a	O
better	O
understanding	O
of	O
information	B-Algorithm
gain	I-Algorithm
,	O
let	O
us	O
break	O
it	O
down	O
.	O
</s>
<s>
As	O
we	O
know	O
,	O
information	B-Algorithm
gain	I-Algorithm
is	O
the	O
reduction	O
in	O
information	O
entropy	O
,	O
what	O
is	O
entropy	O
?	O
</s>
<s>
It	O
determines	O
how	O
a	O
decision	B-Algorithm
tree	I-Algorithm
chooses	O
to	O
split	O
data	O
.	O
</s>
<s>
Now	O
,	O
it	O
is	O
clear	O
that	O
information	B-Algorithm
gain	I-Algorithm
is	O
the	O
measure	O
of	O
how	O
much	O
information	O
a	O
feature	B-Algorithm
provides	O
about	O
a	O
class	O
.	O
</s>
<s>
Let	O
's	O
visualize	O
information	B-Algorithm
gain	I-Algorithm
in	O
a	O
decision	B-Algorithm
tree	I-Algorithm
as	O
shown	O
in	O
the	O
right	O
:	O
</s>
<s>
We	O
can	O
use	O
information	B-Algorithm
gain	I-Algorithm
to	O
determine	O
how	O
good	O
the	O
splitting	O
of	O
nodes	O
is	O
in	O
a	O
decision	B-Algorithm
tree	I-Algorithm
.	O
</s>
<s>
In	O
terms	O
of	O
entropy	O
,	O
information	B-Algorithm
gain	I-Algorithm
is	O
defined	O
as	O
:	O
</s>
<s>
To	O
understand	O
this	O
idea	O
,	O
let	O
's	O
start	O
by	O
an	O
example	B-Algorithm
in	O
which	O
we	O
create	O
a	O
simple	O
dataset	O
and	O
want	O
to	O
see	O
if	O
gene	O
mutations	O
could	O
be	O
related	O
to	O
patients	O
with	O
cancer	O
.	O
</s>
<s>
Using	O
this	O
data	O
,	O
a	O
decision	B-Algorithm
tree	I-Algorithm
can	O
be	O
created	O
with	O
information	B-Algorithm
gain	I-Algorithm
used	O
to	O
determine	O
the	O
candidate	O
splits	O
for	O
each	O
node	O
.	O
</s>
<s>
n(t )	O
,	O
n(t, C )	O
,	O
and	O
n(t, NC )	O
are	O
the	O
number	O
of	O
total	O
samples	O
,	O
‘	O
C’	O
samples	O
and	O
‘	O
NC’	O
samples	O
at	O
node	O
t	O
respectively.Using	O
this	O
with	O
the	O
example	B-Algorithm
training	O
set	O
,	O
the	O
process	O
for	O
finding	O
information	B-Algorithm
gain	I-Algorithm
beginning	O
with	O
for	O
Mutation	O
1	O
is	O
as	O
follows	O
:	O
</s>
<s>
Moving	O
on	O
,	O
the	O
entropy	O
at	O
left	O
and	O
right	O
child	O
nodes	O
of	O
the	O
above	O
decision	B-Algorithm
tree	I-Algorithm
is	O
computed	O
using	O
the	O
formulae:H(tL )	O
=	O
−[ pC	O
,	O
L	O
log2(pC,L )	O
+	O
pNC	O
,	O
L	O
log2(pNC,L )	O
]	O
H(tR )	O
=	O
−[ pC	O
,	O
R	O
log2(pC,R )	O
+	O
pNC	O
,	O
R	O
log2(pNC,R )	O
]	O
where	O
,	O
</s>
<s>
After	O
all	O
the	O
steps	O
,	O
gain(s )	O
,	O
where	O
s	O
is	O
a	O
candidate	O
split	O
for	O
the	O
example	B-Algorithm
is	O
:	O
</s>
<s>
Using	O
this	O
same	O
set	O
of	O
formulae	O
with	O
the	O
other	O
three	O
mutations	O
leads	O
to	O
a	O
table	O
of	O
the	O
candidate	O
splits	O
,	O
ranked	O
by	O
their	O
information	B-Algorithm
gain	I-Algorithm
:	O
</s>
<s>
The	O
mutation	O
that	O
provides	O
the	O
most	O
useful	O
information	O
would	O
be	O
Mutation	O
3	O
,	O
so	O
that	O
will	O
be	O
used	O
to	O
split	O
the	O
root	O
node	O
of	O
the	O
decision	B-Algorithm
tree	I-Algorithm
.	O
</s>
<s>
This	O
tree	O
is	O
relatively	O
accurate	O
at	O
classifying	O
the	O
samples	O
that	O
were	O
used	O
to	O
build	O
it	O
(	O
which	O
is	O
a	O
case	O
of	O
overfitting	B-Error_Name
)	O
,	O
but	O
it	O
would	O
still	O
classify	O
sample	O
C2	O
incorrectly	O
.	O
</s>
<s>
To	O
split	O
the	O
right	O
node	O
,	O
information	B-Algorithm
gain	I-Algorithm
must	O
again	O
be	O
calculated	O
for	O
all	O
the	O
possible	O
candidate	O
splits	O
that	O
were	O
not	O
used	O
for	O
previous	O
nodes	O
.	O
</s>
<s>
This	O
is	O
n't	O
a	O
good	O
idea	O
,	O
however	O
,	O
since	O
the	O
tree	O
would	O
overfit	B-Error_Name
the	O
data	O
.	O
</s>
<s>
Information	B-Algorithm
gain	I-Algorithm
is	O
the	O
basic	O
criterion	O
to	O
decide	O
whether	O
a	O
feature	B-Algorithm
should	O
be	O
used	O
to	O
split	O
a	O
node	O
or	O
not	O
.	O
</s>
<s>
The	O
feature	B-Algorithm
with	O
the	O
optimal	O
split	O
i.e.	O
,	O
the	O
highest	O
value	O
of	O
information	B-Algorithm
gain	I-Algorithm
at	O
a	O
node	O
of	O
a	O
decision	B-Algorithm
tree	I-Algorithm
is	O
used	O
as	O
the	O
feature	B-Algorithm
for	O
splitting	O
the	O
node	O
.	O
</s>
<s>
The	O
concept	O
of	O
information	B-Algorithm
gain	I-Algorithm
function	O
falls	O
under	O
the	O
C4.5	B-Algorithm
algorithm	I-Algorithm
for	O
generating	O
the	O
decision	B-Algorithm
trees	I-Algorithm
and	O
selecting	O
the	O
optimal	O
split	O
for	O
a	O
decision	B-Algorithm
tree	I-Algorithm
node	O
.	O
</s>
<s>
Although	O
information	B-Algorithm
gain	I-Algorithm
is	O
usually	O
a	O
good	O
measure	O
for	O
deciding	O
the	O
relevance	O
of	O
an	O
attribute	B-Algorithm
,	O
it	O
is	O
not	O
perfect	O
.	O
</s>
<s>
A	O
notable	O
problem	O
occurs	O
when	O
information	B-Algorithm
gain	I-Algorithm
is	O
applied	O
to	O
attributes	O
that	O
can	O
take	O
on	O
a	O
large	O
number	O
of	O
distinct	O
values	O
.	O
</s>
<s>
For	O
example	B-Algorithm
,	O
suppose	O
that	O
one	O
is	O
building	O
a	O
decision	B-Algorithm
tree	I-Algorithm
for	O
some	O
data	O
describing	O
the	O
customers	O
of	O
a	O
business	O
.	O
</s>
<s>
Information	B-Algorithm
gain	I-Algorithm
is	O
often	O
used	O
to	O
decide	O
which	O
of	O
the	O
attributes	O
are	O
the	O
most	O
relevant	O
,	O
so	O
they	O
can	O
be	O
tested	O
near	O
the	O
root	O
of	O
the	O
tree	O
.	O
</s>
<s>
This	O
attribute	B-Algorithm
has	O
a	O
high	O
mutual	O
information	O
,	O
because	O
it	O
uniquely	O
identifies	O
each	O
customer	O
,	O
but	O
we	O
do	O
not	O
want	O
to	O
include	O
it	O
in	O
the	O
decision	B-Algorithm
tree	I-Algorithm
.	O
</s>
<s>
Deciding	O
how	O
to	O
treat	O
a	O
customer	O
based	O
on	O
their	O
membership	O
number	O
is	O
unlikely	O
to	O
generalize	O
to	O
customers	O
we	O
have	O
n't	O
seen	O
before	O
(	O
overfitting	B-Error_Name
)	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
it	O
can	O
cause	O
the	O
information	B-Algorithm
gain	I-Algorithm
of	O
each	O
of	O
these	O
attributes	O
to	O
be	O
much	O
higher	O
than	O
those	O
without	O
as	O
many	O
distinct	O
values	O
.	O
</s>
<s>
To	O
counter	O
this	O
problem	O
,	O
Ross	O
Quinlan	O
proposed	O
to	O
instead	O
choose	O
the	O
attribute	B-Algorithm
with	O
highest	O
information	B-General_Concept
gain	I-General_Concept
ratio	I-General_Concept
from	O
among	O
the	O
attributes	O
whose	O
information	B-Algorithm
gain	I-Algorithm
is	O
average	O
or	O
higher	O
.	O
</s>
<s>
This	O
biases	O
the	O
decision	B-Algorithm
tree	I-Algorithm
against	O
considering	O
attributes	O
with	O
a	O
large	O
number	O
of	O
distinct	O
values	O
,	O
while	O
not	O
giving	O
an	O
unfair	O
advantage	O
to	O
attributes	O
with	O
very	O
low	O
information	O
value	O
,	O
as	O
the	O
information	O
value	O
is	O
higher	O
or	O
equal	O
to	O
the	O
information	B-Algorithm
gain	I-Algorithm
.	O
</s>
