<s>
Bootstrap	B-Algorithm
aggregating	I-Algorithm
,	O
also	O
called	O
bagging	B-Application
(	O
from	O
bootstrap	B-Algorithm
aggregating	I-Algorithm
)	O
,	O
is	O
a	O
machine	B-Algorithm
learning	I-Algorithm
ensemble	I-Algorithm
meta-algorithm	B-Algorithm
designed	O
to	O
improve	O
the	O
stability	B-General_Concept
and	O
accuracy	O
of	O
machine	O
learning	O
algorithms	O
used	O
in	O
statistical	B-General_Concept
classification	I-General_Concept
and	O
regression	O
.	O
</s>
<s>
It	O
also	O
reduces	O
variance	O
and	O
helps	O
to	O
avoid	O
overfitting	B-Error_Name
.	O
</s>
<s>
Although	O
it	O
is	O
usually	O
applied	O
to	O
decision	B-Algorithm
tree	I-Algorithm
methods	O
,	O
it	O
can	O
be	O
used	O
with	O
any	O
type	O
of	O
method	O
.	O
</s>
<s>
Bagging	B-Application
is	O
a	O
special	O
case	O
of	O
the	O
model	B-Algorithm
averaging	I-Algorithm
approach	O
.	O
</s>
<s>
Given	O
a	O
standard	O
training	O
set	O
of	O
size	O
n	O
,	O
bagging	B-Application
generates	O
m	O
new	O
training	O
sets	O
,	O
each	O
of	O
size	O
n′	O
,	O
by	O
sampling	O
from	O
D	O
uniformly	O
and	O
with	O
replacement	O
.	O
</s>
<s>
This	O
kind	O
of	O
sample	O
is	O
known	O
as	O
a	O
bootstrap	B-Application
sample	I-Application
.	O
</s>
<s>
Sampling	O
with	O
replacement	O
ensures	O
each	O
bootstrap	B-Application
is	O
independent	O
from	O
its	O
peers	O
,	O
as	O
it	O
does	O
not	O
depend	O
on	O
previous	O
chosen	O
samples	O
when	O
sampling	O
.	O
</s>
<s>
Then	O
,	O
m	O
models	O
are	O
fitted	O
using	O
the	O
above	O
m	O
bootstrap	B-Application
samples	I-Application
and	O
combined	O
by	O
averaging	O
the	O
output	O
(	O
for	O
regression	O
)	O
or	O
voting	O
(	O
for	O
classification	O
)	O
.	O
</s>
<s>
Bagging	B-Application
leads	O
to	O
"	O
improvements	O
for	O
unstable	O
procedures	O
"	O
,	O
which	O
include	O
,	O
for	O
example	O
,	O
artificial	B-Architecture
neural	I-Architecture
networks	I-Architecture
,	O
classification	B-Algorithm
and	I-Algorithm
regression	I-Algorithm
trees	I-Algorithm
,	O
and	O
subset	O
selection	O
in	O
linear	B-General_Concept
regression	I-General_Concept
.	O
</s>
<s>
Bagging	B-Application
was	O
shown	O
to	O
improve	O
preimage	O
learning	O
.	O
</s>
<s>
There	O
are	O
three	O
types	O
of	O
datasets	O
in	O
bootstrap	B-Algorithm
aggregating	I-Algorithm
.	O
</s>
<s>
These	O
are	O
the	O
original	O
,	O
bootstrap	B-Application
,	O
and	O
out-of-bag	O
datasets	O
.	O
</s>
<s>
The	B-Application
bootstrap	I-Application
dataset	O
is	O
made	O
by	O
randomly	O
picking	O
objects	O
from	O
the	O
original	O
dataset	O
.	O
</s>
<s>
However	O
,	O
the	O
difference	O
is	O
that	O
the	B-Application
bootstrap	I-Application
dataset	O
can	O
have	O
duplicate	O
objects	O
.	O
</s>
<s>
By	O
randomly	O
picking	O
a	O
group	O
of	O
names	O
,	O
let	O
us	O
say	O
our	O
bootstrap	B-Application
dataset	O
had	O
James	O
,	O
Ellie	O
,	O
Constantine	O
,	O
Lexi	O
,	O
John	O
,	O
Constantine	O
,	O
Theodore	O
,	O
Constantine	O
,	O
Anthony	O
,	O
Lexi	O
,	O
Constantine	O
,	O
and	O
Theodore	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	B-Application
bootstrap	I-Application
sample	O
contained	O
four	O
duplicates	O
for	O
Constantine	O
,	O
and	O
two	O
duplicates	O
for	O
Lexi	O
,	O
and	O
Theodore	O
.	O
</s>
<s>
The	O
out-of-bag	O
dataset	O
represents	O
the	O
remaining	O
people	O
who	O
were	O
not	O
in	O
the	B-Application
bootstrap	I-Application
dataset	O
.	O
</s>
<s>
It	O
can	O
be	O
calculated	O
by	O
taking	O
the	O
difference	O
between	O
the	O
original	O
and	O
the	B-Application
bootstrap	I-Application
datasets	O
.	O
</s>
<s>
Keep	O
in	O
mind	O
that	O
since	O
both	O
datasets	O
are	O
sets	O
,	O
when	O
taking	O
the	O
difference	O
the	O
duplicate	O
names	O
are	O
ignored	O
in	O
the	B-Application
bootstrap	I-Application
dataset	O
.	O
</s>
<s>
Creating	O
the	B-Application
bootstrap	I-Application
and	O
out-of-bag	O
datasets	O
is	O
crucial	O
since	O
it	O
is	O
used	O
to	O
test	O
the	O
accuracy	O
of	O
a	O
random	B-Algorithm
forest	I-Algorithm
algorithm	O
.	O
</s>
<s>
Since	O
the	O
algorithm	O
generates	O
multiple	O
trees	O
and	O
therefore	O
multiple	O
datasets	O
the	O
chance	O
that	O
an	O
object	O
is	O
left	O
out	O
of	O
the	B-Application
bootstrap	I-Application
dataset	O
is	O
low	O
.	O
</s>
<s>
The	O
next	O
few	O
sections	O
talk	O
about	O
how	O
the	O
random	B-Algorithm
forest	I-Algorithm
algorithm	O
works	O
in	O
more	O
detail	O
.	O
</s>
<s>
The	O
next	O
step	O
of	O
the	O
algorithm	O
involves	O
the	O
generation	O
of	O
decision	B-Algorithm
trees	I-Algorithm
from	O
the	O
bootstrapped	O
dataset	O
.	O
</s>
<s>
This	O
information	O
is	O
then	O
used	O
to	O
compute	O
a	O
confusion	B-General_Concept
matrix	I-General_Concept
,	O
which	O
lists	O
the	O
true	O
positives	O
,	O
false	O
positives	O
,	O
true	O
negatives	O
,	O
and	O
false	O
negatives	O
of	O
the	O
feature	O
when	O
used	O
as	O
a	O
classifier	B-General_Concept
.	O
</s>
<s>
These	O
features	O
are	O
then	O
ranked	O
according	O
to	O
various	O
classification	B-Algorithm
metrics	I-Algorithm
based	O
on	O
their	O
confusion	O
matrices	O
.	O
</s>
<s>
Some	O
common	O
metrics	O
include	O
estimate	O
of	O
positive	O
correctness	O
(	O
calculated	O
by	O
subtracting	O
false	O
positives	O
from	O
true	O
positives	O
)	O
,	O
measure	O
of	O
"	O
goodness	O
"	O
,	O
and	O
information	B-Algorithm
gain	I-Algorithm
.	O
</s>
<s>
The	O
diagram	O
below	O
shows	O
a	O
decision	B-Algorithm
tree	I-Algorithm
of	O
depth	O
two	O
being	O
used	O
to	O
classify	O
data	O
.	O
</s>
<s>
In	O
addition	O
to	O
each	O
tree	O
only	O
examining	O
a	O
bootstrapped	O
set	O
of	O
samples	O
,	O
only	O
a	O
small	O
but	O
consistent	O
number	O
of	O
unique	O
features	O
are	O
considered	O
when	O
ranking	O
them	O
as	O
classifiers	B-General_Concept
.	O
</s>
<s>
This	O
results	O
in	O
a	O
random	B-Algorithm
forest	I-Algorithm
,	O
which	O
possesses	O
numerous	O
benefits	O
over	O
a	O
single	O
decision	B-Algorithm
tree	I-Algorithm
generated	O
without	O
randomness	O
.	O
</s>
<s>
In	O
a	O
random	B-Algorithm
forest	I-Algorithm
,	O
each	O
tree	O
"	O
votes	O
"	O
on	O
whether	O
or	O
not	O
to	O
classify	O
a	O
sample	O
as	O
positive	O
based	O
on	O
its	O
features	O
.	O
</s>
<s>
An	O
example	O
of	O
this	O
is	O
given	O
in	O
the	O
diagram	O
below	O
,	O
where	O
the	O
four	O
trees	O
in	O
a	O
random	B-Algorithm
forest	I-Algorithm
vote	O
on	O
whether	O
or	O
not	O
a	O
patient	O
with	O
mutations	O
A	O
,	O
B	O
,	O
F	O
,	O
and	O
G	O
has	O
cancer	O
.	O
</s>
<s>
Because	O
of	O
their	O
properties	O
,	O
random	B-Algorithm
forests	I-Algorithm
are	O
considered	O
one	O
of	O
the	O
most	O
accurate	O
data	O
mining	O
algorithms	O
,	O
are	O
less	O
likely	O
to	O
overfit	B-Error_Name
their	O
data	O
,	O
and	O
run	O
quickly	O
and	O
efficiently	O
even	O
for	O
large	O
datasets	O
.	O
</s>
<s>
This	O
makes	O
random	B-Algorithm
forests	I-Algorithm
particularly	O
useful	O
in	O
such	O
fields	O
as	O
banking	O
,	O
healthcare	O
,	O
the	O
stock	O
market	O
,	O
and	O
e-commerce	O
where	O
it	O
is	O
important	O
to	O
be	O
able	O
to	O
predict	O
future	O
results	O
based	O
on	O
past	O
data	O
.	O
</s>
<s>
There	O
are	O
several	O
important	O
factors	O
to	O
consider	O
when	O
designing	O
a	O
random	B-Algorithm
forest	I-Algorithm
.	O
</s>
<s>
If	O
the	O
trees	O
in	O
the	O
random	B-Algorithm
forests	I-Algorithm
are	O
too	O
deep	O
,	O
overfitting	B-Error_Name
can	O
still	O
occur	O
due	O
to	O
over-specificity	O
.	O
</s>
<s>
Random	B-Algorithm
forests	I-Algorithm
also	O
do	O
not	O
generally	O
perform	O
well	O
when	O
given	O
sparse	O
data	O
with	O
little	O
variability	O
.	O
</s>
<s>
However	O
,	O
they	O
still	O
have	O
numerous	O
advantages	O
over	O
similar	O
data	O
classification	O
algorithms	O
such	O
as	O
neural	B-Architecture
networks	I-Architecture
,	O
as	O
they	O
are	O
much	O
easier	O
to	O
interpret	O
and	O
generally	O
require	O
less	O
data	O
for	O
training	O
.	O
</s>
<s>
As	O
an	O
integral	O
component	O
of	O
random	B-Algorithm
forests	I-Algorithm
,	O
bootstrap	B-Algorithm
aggregating	I-Algorithm
is	O
very	O
important	O
to	O
classification	O
algorithms	O
,	O
and	O
provides	O
a	O
critical	O
element	O
of	O
variability	O
that	O
allows	O
for	O
increased	O
accuracy	O
when	O
analyzing	O
new	O
data	O
,	O
as	O
discussed	O
below	O
.	O
</s>
<s>
While	O
the	O
techniques	O
described	O
above	O
utilize	O
random	B-Algorithm
forests	I-Algorithm
and	O
bagging	B-Application
(	O
otherwise	O
known	O
as	O
bootstrapping	B-Application
)	O
,	O
there	O
are	O
certain	O
techniques	O
that	O
can	O
be	O
used	O
in	O
order	O
to	O
improve	O
their	O
execution	O
and	O
voting	O
time	O
,	O
their	O
prediction	O
accuracy	O
,	O
and	O
their	O
overall	O
performance	O
.	O
</s>
<s>
The	O
following	O
are	O
key	O
steps	O
in	O
creating	O
an	O
efficient	O
random	B-Algorithm
forest	I-Algorithm
:	O
</s>
<s>
Specify	O
the	O
maximum	O
depth	O
of	O
trees	O
:	O
Instead	O
of	O
allowing	O
your	O
random	B-Algorithm
forest	I-Algorithm
to	O
continue	O
until	O
all	O
nodes	O
are	O
pure	O
,	O
it	O
is	O
better	O
to	O
cut	O
it	O
off	O
at	O
a	O
certain	O
point	O
in	O
order	O
to	O
further	O
decrease	O
chances	O
of	O
overfitting	B-Error_Name
.	O
</s>
<s>
Continue	O
pruning	O
the	O
data	O
at	O
each	O
node	O
split	O
rather	O
than	O
just	O
in	O
the	O
original	O
bagging	B-Application
process	O
.	O
</s>
<s>
+Pros	O
and	O
Cons	O
of	O
Random	B-Algorithm
Forests	I-Algorithm
and	O
Bagging	B-Application
ProsConsThere	O
are	O
overall	O
less	O
requirements	O
involved	O
for	O
normalization	O
and	O
scaling	O
,	O
making	O
the	O
use	O
of	O
random	B-Algorithm
forests	I-Algorithm
more	O
convenient.The	O
algorithm	O
may	O
change	O
significantly	O
if	O
there	O
is	O
a	O
slight	O
change	O
to	O
the	O
data	O
being	O
bootstrapped	O
and	O
used	O
within	O
the	O
forests	O
.	O
</s>
<s>
In	O
other	O
words	O
,	O
random	B-Algorithm
forests	I-Algorithm
are	O
incredibly	O
dependent	O
on	O
their	O
data	O
sets	O
,	O
changing	O
these	O
can	O
drastically	O
change	O
the	O
individual	O
trees	O
 '	O
structures	O
.	O
</s>
<s>
Data	O
is	O
prepared	O
by	O
creating	O
a	O
bootstrap	B-Application
set	O
and	O
a	O
certain	O
number	O
of	O
decision	B-Algorithm
trees	I-Algorithm
to	O
build	O
a	O
random	B-Algorithm
forest	I-Algorithm
that	O
also	O
utilizes	O
feature	O
selection	O
,	O
as	O
mentioned	O
in	O
the	O
Random	B-Algorithm
Forests	I-Algorithm
section	O
.	O
</s>
<s>
Random	B-Algorithm
Forests	I-Algorithm
are	O
more	O
complex	O
to	O
implement	O
than	O
lone	O
decision	B-Algorithm
trees	I-Algorithm
or	O
other	O
algorithms	O
.	O
</s>
<s>
This	O
is	O
because	O
they	O
take	O
extra	O
steps	O
for	O
bagging	B-Application
,	O
as	O
well	O
as	O
the	O
need	O
for	O
recursion	O
in	O
order	O
to	O
produce	O
an	O
entire	O
forest	O
,	O
which	O
complicates	O
implementation	O
.	O
</s>
<s>
Consisting	O
of	O
multiple	O
decision	B-Algorithm
trees	I-Algorithm
,	O
forests	O
are	O
able	O
to	O
more	O
accurately	O
make	O
predictions	O
than	O
single	O
trees	O
.	O
</s>
<s>
Requires	O
much	O
more	O
time	O
to	O
train	O
the	O
data	O
compared	O
to	O
decision	B-Algorithm
trees	I-Algorithm
.	O
</s>
<s>
Working	O
well	O
with	O
non-linear	O
data	O
is	O
a	O
huge	O
advantage	O
because	O
other	O
data	O
mining	O
techniques	O
such	O
as	O
single	O
decision	B-Algorithm
trees	I-Algorithm
do	O
not	O
handle	O
this	O
as	O
well	O
.	O
</s>
<s>
Much	O
easier	O
to	O
interpret	O
than	O
a	O
random	B-Algorithm
forest	I-Algorithm
.	O
</s>
<s>
There	O
is	O
a	O
lower	O
risk	O
of	O
overfitting	B-Error_Name
and	O
runs	O
efficiently	O
on	O
even	O
large	O
data	O
sets	O
.	O
</s>
<s>
This	O
is	O
the	O
result	O
of	O
the	O
random	B-Algorithm
forest	I-Algorithm
's	O
use	O
of	O
bagging	B-Application
in	O
conjunction	O
with	O
random	O
feature	O
selection	O
.	O
</s>
<s>
This	O
is	O
a	O
con	O
because	O
while	O
bagging	B-Application
is	O
often	O
effective	O
,	O
all	O
of	O
the	O
data	O
is	O
not	O
being	O
considered	O
,	O
therefore	O
it	O
cannot	O
predict	O
an	O
entire	O
dataset	O
.	O
</s>
<s>
The	O
random	B-Algorithm
forest	I-Algorithm
classifier	B-General_Concept
operates	O
with	O
a	O
high	O
accuracy	O
and	O
speed	O
.	O
</s>
<s>
Random	B-Algorithm
forests	I-Algorithm
are	O
much	O
faster	O
than	O
decision	B-Algorithm
trees	I-Algorithm
because	O
of	O
using	O
a	O
smaller	O
data	O
set	O
.	O
</s>
<s>
To	O
recreate	O
specific	O
results	O
you	O
need	O
to	O
keep	O
track	O
of	O
the	O
exact	O
random	O
seed	O
used	O
to	O
generate	O
the	B-Application
bootstrap	I-Application
sets	O
.	O
</s>
<s>
Using	O
random	O
seeds	O
is	O
essential	O
to	O
the	O
random	B-Algorithm
forests	I-Algorithm
,	O
but	O
can	O
make	O
it	O
hard	O
to	O
support	O
your	O
statements	O
based	O
on	O
forests	O
if	O
there	O
is	O
a	O
failure	O
to	O
record	O
the	O
seeds	O
.	O
</s>
<s>
They	O
deal	O
with	O
this	O
by	O
using	O
binning	B-General_Concept
,	O
or	O
by	O
grouping	O
values	O
together	O
to	O
avoid	O
values	O
that	O
are	O
terribly	O
far	O
apart	O
.	O
</s>
<s>
For	O
classification	O
,	O
use	O
a	O
training	O
set	O
,	O
Inducer	O
and	O
the	O
number	O
of	O
bootstrap	B-Application
samples	I-Application
as	O
input	O
.	O
</s>
<s>
To	O
illustrate	O
the	O
basic	O
principles	O
of	O
bagging	B-Application
,	O
below	O
is	O
an	O
analysis	O
on	O
the	O
relationship	O
between	O
ozone	O
and	O
temperature	O
(	O
data	O
from	O
Rousseeuw	O
and	O
Leroy	O
(	O
1986	O
)	O
,	O
analysis	O
done	O
in	O
R	B-Language
)	O
.	O
</s>
<s>
Rather	O
than	O
building	O
a	O
single	O
smoother	O
for	O
the	O
complete	O
data	O
set	O
,	O
100	O
bootstrap	B-Application
samples	I-Application
were	O
drawn	O
.	O
</s>
<s>
For	O
each	O
bootstrap	B-Application
sample	I-Application
,	O
a	O
LOESS	O
smoother	O
was	O
fit	O
.	O
</s>
<s>
The	O
lines	O
lack	O
agreement	O
in	O
their	O
predictions	O
and	O
tend	O
to	O
overfit	B-Error_Name
their	O
data	O
points	O
:	O
evident	O
by	O
the	O
wobbly	O
flow	O
of	O
the	O
lines	O
.	O
</s>
<s>
The	O
concept	O
of	O
bootstrap	B-Algorithm
aggregating	I-Algorithm
is	O
derived	O
from	O
the	O
concept	O
of	O
bootstrapping	B-Application
which	O
was	O
developed	O
by	O
Bradley	O
Efron	O
.	O
</s>
<s>
Bootstrap	B-Algorithm
aggregating	I-Algorithm
was	O
proposed	O
by	O
Leo	O
Breiman	O
who	O
also	O
coined	O
the	O
abbreviated	O
term	O
"	O
bagging	B-Application
"	O
(	O
bootstrap	B-Algorithm
aggregating	I-Algorithm
)	O
.	O
</s>
<s>
Breiman	O
developed	O
the	O
concept	O
of	O
bagging	B-Application
in	O
1994	O
to	O
improve	O
classification	O
by	O
combining	O
classifications	O
of	O
randomly	O
generated	O
training	O
sets	O
.	O
</s>
<s>
He	O
argued	O
,	O
"	O
If	O
perturbing	O
the	O
learning	O
set	O
can	O
cause	O
significant	O
changes	O
in	O
the	O
predictor	O
constructed	O
,	O
then	O
bagging	B-Application
can	O
improve	O
accuracy	O
"	O
.	O
</s>
