<s>
In	O
decision	B-Algorithm
tree	I-Algorithm
learning	I-Algorithm
,	O
ID3	O
(	O
Iterative	B-Algorithm
Dichotomiser	I-Algorithm
3	I-Algorithm
)	O
is	O
an	O
algorithm	O
invented	O
by	O
Ross	O
Quinlan	O
used	O
to	O
generate	O
a	O
decision	B-Application
tree	I-Application
from	O
a	O
dataset	B-General_Concept
.	O
</s>
<s>
ID3	O
is	O
the	O
precursor	O
to	O
the	O
C4.5	B-Algorithm
algorithm	I-Algorithm
,	O
and	O
is	O
typically	O
used	O
in	O
the	O
machine	O
learning	O
and	O
natural	B-Language
language	I-Language
processing	I-Language
domains	O
.	O
</s>
<s>
The	O
ID3	B-Algorithm
algorithm	I-Algorithm
begins	O
with	O
the	O
original	O
set	O
as	O
the	O
root	B-Application
node	I-Application
.	O
</s>
<s>
On	O
each	O
iteration	B-Algorithm
of	O
the	O
algorithm	O
,	O
it	O
iterates	B-Algorithm
through	O
every	O
unused	O
attribute	B-Algorithm
of	O
the	O
set	O
and	O
calculates	O
the	O
entropy	O
or	O
the	O
information	B-Algorithm
gain	I-Algorithm
of	O
that	O
attribute	B-Algorithm
.	O
</s>
<s>
It	O
then	O
selects	O
the	O
attribute	B-Algorithm
which	O
has	O
the	O
smallest	O
entropy	O
(	O
or	O
largest	O
information	B-Algorithm
gain	I-Algorithm
)	O
value	O
.	O
</s>
<s>
The	O
set	O
is	O
then	O
split	O
or	O
partitioned	O
by	O
the	O
selected	O
attribute	B-Algorithm
to	O
produce	O
subsets	O
of	O
the	O
data	O
.	O
</s>
<s>
(	O
For	O
example	O
,	O
a	O
node	B-Data_Structure
can	O
be	O
split	O
into	O
child	B-Data_Structure
nodes	I-Data_Structure
based	O
upon	O
the	O
subsets	O
of	O
the	O
population	O
whose	O
ages	O
are	O
less	O
than	O
50	O
,	O
between	O
50	O
and	O
100	O
,	O
and	O
greater	O
than	O
100	O
.	O
)	O
</s>
<s>
every	O
element	O
in	O
the	O
subset	O
belongs	O
to	O
the	O
same	O
class	O
;	O
in	O
which	O
case	O
the	O
node	B-Data_Structure
is	O
turned	O
into	O
a	O
leaf	B-Data_Structure
node	I-Data_Structure
and	O
labelled	O
with	O
the	O
class	O
of	O
the	O
examples	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
node	B-Data_Structure
is	O
made	O
a	O
leaf	B-Data_Structure
node	I-Data_Structure
and	O
labelled	O
with	O
the	O
most	O
common	O
class	O
of	O
the	O
examples	O
in	O
the	O
subset	O
.	O
</s>
<s>
there	O
are	O
no	O
examples	O
in	O
the	O
subset	O
,	O
which	O
happens	O
when	O
no	O
example	O
in	O
the	O
parent	O
set	O
was	O
found	O
to	O
match	O
a	O
specific	O
value	O
of	O
the	O
selected	O
attribute	B-Algorithm
.	O
</s>
<s>
Then	O
a	O
leaf	B-Data_Structure
node	I-Data_Structure
is	O
created	O
and	O
labelled	O
with	O
the	O
most	O
common	O
class	O
of	O
the	O
examples	O
in	O
the	O
parent	B-Application
node	I-Application
's	O
set	O
.	O
</s>
<s>
Throughout	O
the	O
algorithm	O
,	O
the	O
decision	B-Application
tree	I-Application
is	O
constructed	O
with	O
each	O
non-terminal	O
node	B-Data_Structure
(	O
internal	O
node	B-Data_Structure
)	O
representing	O
the	O
selected	O
attribute	B-Algorithm
on	O
which	O
the	O
data	O
was	O
split	O
,	O
and	O
terminal	O
nodes	O
(	O
leaf	B-Data_Structure
nodes	I-Data_Structure
)	O
representing	O
the	O
class	O
label	O
of	O
the	O
final	O
subset	O
of	O
this	O
branch	O
.	O
</s>
<s>
Calculate	O
the	O
entropy	O
of	O
every	O
attribute	B-Algorithm
of	O
the	O
data	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
Partition	O
(	O
"	O
split	O
"	O
)	O
the	O
set	O
into	O
subsets	O
using	O
the	O
attribute	B-Algorithm
for	O
which	O
the	O
resulting	O
entropy	O
after	O
splitting	O
is	O
minimized	O
;	O
or	O
,	O
equivalently	O
,	O
information	B-Algorithm
gain	I-Algorithm
is	O
maximum	O
.	O
</s>
<s>
Make	O
a	O
decision	B-Application
tree	I-Application
node	B-Data_Structure
containing	O
that	O
attribute	B-Algorithm
.	O
</s>
<s>
If	O
all	O
examples	O
are	O
positive	O
,	O
Return	O
the	O
single-node	O
tree	O
Root	O
,	O
with	O
label	O
=	O
+	O
.	O
</s>
<s>
If	O
all	O
examples	O
are	O
negative	O
,	O
Return	O
the	O
single-node	O
tree	O
Root	O
,	O
with	O
label	O
=	O
-	O
.	O
</s>
<s>
If	O
number	O
of	O
predicting	O
attributes	O
is	O
empty	O
,	O
then	O
Return	O
the	O
single	O
node	B-Data_Structure
tree	O
Root	O
,	O
</s>
<s>
with	O
label	O
=	O
most	O
common	O
value	O
of	O
the	O
target	O
attribute	B-Algorithm
in	O
the	O
examples	O
.	O
</s>
<s>
A	O
←	O
The	O
Attribute	B-Algorithm
that	O
best	O
classifies	O
examples	O
.	O
</s>
<s>
Decision	B-Application
Tree	I-Application
attribute	B-Algorithm
for	O
Root	O
=	O
A	O
.	O
</s>
<s>
It	O
uses	O
a	O
greedy	B-Algorithm
strategy	I-Algorithm
by	O
selecting	O
the	O
locally	O
best	O
attribute	B-Algorithm
to	O
split	O
the	O
dataset	B-General_Concept
on	O
each	O
iteration	B-Algorithm
.	O
</s>
<s>
The	O
algorithm	O
's	O
optimality	O
can	O
be	O
improved	O
by	O
using	O
backtracking	B-Algorithm
during	O
the	O
search	O
for	O
the	O
optimal	O
decision	B-Application
tree	I-Application
at	O
the	O
cost	O
of	O
possibly	O
taking	O
longer	O
.	O
</s>
<s>
ID3	O
can	O
overfit	B-Error_Name
the	O
training	O
data	O
.	O
</s>
<s>
To	O
avoid	O
overfitting	B-Error_Name
,	O
smaller	O
decision	B-Application
trees	I-Application
should	O
be	O
preferred	O
over	O
larger	O
ones	O
.	O
</s>
<s>
This	O
algorithm	O
usually	O
produces	O
small	O
trees	O
,	O
but	O
it	O
does	O
not	O
always	O
produce	O
the	O
smallest	O
possible	O
decision	B-Application
tree	I-Application
.	O
</s>
<s>
If	O
the	O
values	O
of	O
any	O
given	O
attribute	B-Algorithm
are	O
continuous	O
,	O
then	O
there	O
are	O
many	O
more	O
places	O
to	O
split	O
the	O
data	O
on	O
this	O
attribute	B-Algorithm
,	O
and	O
searching	O
for	O
the	O
best	O
value	O
to	O
split	O
by	O
can	O
be	O
time-consuming	O
.	O
</s>
<s>
The	O
ID3	B-Algorithm
algorithm	I-Algorithm
is	O
used	O
by	O
training	O
on	O
a	O
data	B-General_Concept
set	I-General_Concept
to	O
produce	O
a	O
decision	B-Application
tree	I-Application
which	O
is	O
stored	O
in	O
memory	B-General_Concept
.	O
</s>
<s>
At	B-Library
runtime	I-Library
,	O
this	O
decision	B-Application
tree	I-Application
is	O
used	O
to	O
classify	B-General_Concept
new	O
test	O
cases	O
(	O
feature	B-Algorithm
vectors	I-Algorithm
)	O
by	O
traversing	B-Algorithm
the	O
decision	B-Application
tree	I-Application
using	O
the	O
features	O
of	O
the	O
datum	O
to	O
arrive	O
at	O
a	O
leaf	B-Data_Structure
node	I-Data_Structure
.	O
</s>
<s>
This	O
changes	O
at	O
each	O
step	O
of	O
the	O
ID3	B-Algorithm
algorithm	I-Algorithm
,	O
either	O
to	O
a	O
subset	O
of	O
the	O
previous	O
set	O
in	O
the	O
case	O
of	O
splitting	O
on	O
an	O
attribute	B-Algorithm
or	O
to	O
a	O
"	O
sibling	O
"	O
partition	O
of	O
the	O
parent	O
in	O
case	O
the	O
recursion	O
terminated	O
previously	O
.	O
</s>
<s>
In	O
ID3	O
,	O
entropy	O
is	O
calculated	O
for	O
each	O
remaining	O
attribute	B-Algorithm
.	O
</s>
<s>
The	O
attribute	B-Algorithm
with	O
the	O
smallest	O
entropy	O
is	O
used	O
to	O
split	O
the	O
set	O
on	O
this	O
iteration	B-Algorithm
.	O
</s>
<s>
Entropy	O
in	O
information	O
theory	O
measures	O
how	O
much	O
information	O
is	O
expected	O
to	O
be	O
gained	O
upon	O
measuring	B-Algorithm
a	O
random	O
variable	O
;	O
as	O
such	O
,	O
it	O
can	O
also	O
be	O
used	O
to	O
quantify	O
the	O
amount	O
to	O
which	O
the	O
distribution	O
of	O
the	O
quantity	O
's	O
values	O
is	O
unknown	O
.	O
</s>
<s>
Therefore	O
,	O
the	O
greater	O
the	O
entropy	O
at	O
a	O
node	B-Data_Structure
,	O
the	O
less	O
information	O
is	O
known	O
about	O
the	O
classification	O
of	O
data	O
at	O
this	O
stage	O
of	O
the	O
tree	O
;	O
and	O
therefore	O
,	O
the	O
greater	O
the	O
potential	O
to	O
improve	O
the	O
classification	O
here	O
.	O
</s>
<s>
As	O
such	O
,	O
ID3	O
is	O
a	O
greedy	B-Algorithm
heuristic	I-Algorithm
performing	O
a	O
best-first	B-Algorithm
search	I-Algorithm
for	O
locally	O
optimal	O
entropy	O
values	O
.	O
</s>
<s>
Information	B-Algorithm
gain	I-Algorithm
is	O
the	O
measure	O
of	O
the	O
difference	O
in	O
entropy	O
from	O
before	O
to	O
after	O
the	O
set	O
is	O
split	O
on	O
an	O
attribute	B-Algorithm
.	O
</s>
<s>
In	O
other	O
words	O
,	O
how	O
much	O
uncertainty	O
in	O
was	O
reduced	O
after	O
splitting	O
set	O
on	O
attribute	B-Algorithm
.	O
</s>
<s>
In	O
ID3	O
,	O
information	B-Algorithm
gain	I-Algorithm
can	O
be	O
calculated	O
(	O
instead	O
of	O
entropy	O
)	O
for	O
each	O
remaining	O
attribute	B-Algorithm
.	O
</s>
<s>
The	O
attribute	B-Algorithm
with	O
the	O
largest	O
information	B-Algorithm
gain	I-Algorithm
is	O
used	O
to	O
split	O
the	O
set	O
on	O
this	O
iteration	B-Algorithm
.	O
</s>
