# Bagging

​ Bagging算法是另外一类，是一大家族，可以**并行计算**，不像前面的AdaBoost，是一个依赖一个的串行的。这种集成算法数学性并不要求很高。简单易理解。

## 基本流程

> 1）基于自助采样给定m个数据，有放回的采样m次，得到一个包含m个数据的数据集（有些会出现多次，有些不出现，但理论上只有63.2%的概率出现在集合中）。
>
> 2）自助采样T次，就得到了T个含m个数据的数据集。
>
> 3）T次采样每次采样完都训练出一个弱学习器，这样得到T个弱学习器了。
>
> 4）预测，对分类任务：使用投票多数表决了；回归：简单平均。

典型代表：随机森林等，后面具体讲解


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://im-qianuxn.gitbook.io/pytorch/ji-suan-ji/ml/ji-cheng/bagging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
