> For the complete documentation index, see [llms.txt](https://windmising.gitbook.io/lihang-tongjixuexifangfa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windmising.gitbook.io/lihang-tongjixuexifangfa/adaboost/4.md).

# 前向分步算法

**前向分步算法 forward algorithm**

因为学习的是加法模型，如果能从前向后，每一步只学习一个基函数及其系数，逐渐逼近优化目标函数式(2)，那么就可以简化优化的复杂度。\
具体地，每步只需要优化如下损失函数：

$$
\min\_{\beta,\gamma}\sum\_{i=1}^NL(y\_i,\beta b(x\_i;\gamma))
$$

**输入：**\
训练数据集T\
损失函数L(y, f(x))\
基函数集$${b(x;\gamma)}$$\
**输出：**\
加法模型f(x)

**步骤：**\
1\. 令$$f\_0(x)=0$$\
2\. 假设当前是第m个基函数，损失函数为：

$$
L(y\_i,f\_{m-1}(x\_i)+\beta b(x\_i, \gamma))
$$

1. 极小化损失函数，得到参数$$\beta\_m, \gamma\_m$$ &#x20;

   $$
   (\beta\_m, \gamma\_m) = \arg\min\_{\beta, \gamma}\sum\_{i=1}^NL(y\_i,f\_{m-1}(x\_i)+\beta b(x\_i, \gamma))
   $$
2. 更新$$f\_m$$ &#x20;

   $$
   f\_m(x) = f\_{m-1}(x) + \beta\_mb(x;\gamma\_m)
   $$

   5.2-4步进行M次，共得到M个$$\beta$$和$$\gamma$$ &#x20;
3. 得到加法模型 &#x20;

   $$
   f(x) = f\_M(x) = \sum\_{m=1}^M\beta\_mb(x;\gamma\_m)
   $$


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://windmising.gitbook.io/lihang-tongjixuexifangfa/adaboost/4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
