> 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/perceptron2.md).

# 第2章 感知机 - 对偶形式

对偶形式的基本思想：\
将w和b表示为样本（书中术语为实例）$$x\_i$$和标记$$y\_i$$的线性组合形式，通过求解其系数而求得w和b

但变形之后的感知机就从参数学习算法变成了非参数学习算法。因为它的算法模型中还要用到训练数据集X和y

## 模型

$$
\begin{aligned}
f(x) = sign(\sum\_{j=1}^m a\_jy\_jx\_j \cdot x + b)   \\
sign(x) =
\begin{cases}
+1, && x \ge 0 \\
-1, && x \lt 0
\end{cases}
\end{aligned}
$$

其中，m为样本数，n为样本的特征数

## 策略

感知机的损失函数是一个经验风险函数：

$$
L(w, b) = - \sum\_{x\_i \in M}y\_i (\sum\_{j=1}^m a\_jy\_jx\_j \cdot x\_i + b)
$$

其中M是误分类点的集合

感知机的学习策略是从假设空间中选取使损失函数最小的模型参数a, b

## 算法

学习模型的具体方法\
感知机对偶形式使用随机梯度下降法

$$
\begin{cases}
a\_{new} = a\_{old} + \eta \\
b\_{new} = b\_{old} + \eta y\_i
\end{cases}
$$


---

# 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/perceptron2.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.
