
English: 
There's another way we can
build an ensemble of learners.
We can build them using
the same learning algorithm but
train each learner on
a different set of the data.
This is what's called bootstrap
aggregating or bagging.
It was invented by Bremen in
the late '80s, early '90s.
Here's how bagging works.
So what we do is we create
a number of subsets of the data.
I've drawn little bags here
to represent bags of data.
And each one of these is
a subset of the original data.
Now how do we collect these?
Well, we do it randomly.
So for this subset it
contains n prime values and
our original data set contains
n different instances.
We grab n prime of them, at random, with
replacement from this original data.

Chinese: 
还有一种构建集成学习器的方法
我们可以使用相同的学习算法
但是用不同的数据集训练每个学习器
称之为 Bootstrap aggregating 或 bagging
Bremen 在上世纪 80 年代末 90 年代初提出了这个概念
下面说说 bagging 的原理
我们将数据划分成多个子集
我画了几个小袋表示数据子集
每个都是原始数据的一个子集
如何抽取这些数据？
我们随机抽取
这个子集包含 n′ 个样本
原始数据集包含 n 个样本
我们从原始数据中抽出放回地随机选择 n′ 个样本

English: 
So what, with replacement means is,
let's say we had
these values, we might grab this one and
put it in our bag.
We might randomly grab this one and
put it in our bag, but each time we grab
randomly, we randomly choose across
the whole collection of data.
So we might choose this one again and
put it in the bag.
So this one and this one are really
the same one and they're repeated twice.
And that's okay.
That's what with replacement means.
So we crate all together m
of these groups or bags.
And each one of them contains n prime
different data instances chosen
at random with replacement.
Let's note these things.
So, n is the number of training
instances in our original data.
N prime is the number of instances
that we put in each bag and
m is the number of bags.

Chinese: 
抽出放回是指 假设有这些值
我们可能会将这个放入这个小袋里
可能会随机将这个放入小袋里
但是每次随机选择时 都是从整个数据集中选择
可能会再次选择这个
所以这个和这个是相同的 重复了两次
没关系
这就是抽出放回的意思
我们一共创建 m 个子集或小袋
每个都包含抽出放回地随机选择的
n′ 个数据样本
在旁边记录下符号含义
n 表示原始数据中的训练样本数
n′ 表示放入每个小袋中的样本数
m 表示袋数

Chinese: 
n′ 几乎始终小于 n
通常抽取 60%
每个小袋包含的训练样本数
大约是原始数据的 60%
这是一种惯常做法
现在使用每个数据集训练不同的模型
我们有 m 个不同的模型
每个都用不同的数据训练
之前是将不同的算法集成到一起
现在是按照相同的方式查询不同的模型
我们用相同的 x 查询每个模型 并收集所有输出
对每个模型的 y 输出求均值
均值就是集成学习器的 y 输出
注意 我们可以将所有这些封装到一个 API 中
就像把线性回归和 KNN 学习器封装到一个 API 里那样

English: 
We almost always want n
prime to be less than n.
Usually about 60%.
So each of these bags has about
60% as many training instances
as our original data.
That's just a rule of thumb.
Now, we use each of these collections
of data to train a different model.
We have now m different models,
each one trained on a little
bit of different data.
And just like when we have an ensemble
of different learning algorithms,
here we have an ensemble of different
models we query in the same way.
We query each model with the same x and
we collect all of their outputs.
We take the y output of each model,
take their mean, and
boom, that's our y for the ensemble.
Now keep in mind we can
wrap this in a single API.
Just like that API you wrapped your
[INAUDIBLE] in and your KNN learner in.
