# 核技巧在SVM中的应用

根据[上文](https://windmising.gitbook.io/lihang-tongjixuexifangfa/11)可知，将核技巧应用于线性SVM中，可使线性SVM能够解决非线性问题。

根据[上文](https://windmising.gitbook.io/lihang-tongjixuexifangfa/7/8)可知，\
线性SVM最终要解决的是以下最优化问题：

$$
\begin{aligned}
W(a) = \frac{1}{2}\sum\_{i=1}^N\sum\_{j=1}^Na\_ia\_jy\_iy\_j\color{red}{(x\_i\cdot x\_j)} - \sum\_{i=1}^Na\_i && {1}
\end{aligned}
$$

以及最终的分类决策函数为：

$$
\begin{aligned}
f(x) = \text {sign}(\sum\_{i=1}^Na^*\_iy\_i\color{red}{x\_i^* \cdot x} + y\_j - \sum\_{i=1}^Ny\_ia^\*\_i\color{red}{(x\_i \cdot x\_j)}) && {2}
\end{aligned}
$$

在公式（1）和公式（2）中都只涉及x之间的内积，这些内积极都可以直接用$$K(x,z)$$代替\
公式（1）变为：

$$
\begin{aligned}
W(a) = \frac{1}{2}\sum\_{i=1}^N\sum\_{j=1}^Na\_ia\_jy\_iy\_j\color{red}{K(x\_i,x\_j)} - \sum\_{i=1}^Na\_i && {3}
\end{aligned}
$$

公式（2）变为：

$$
\begin{aligned}
f(x) = \text {sign}(\sum\_{i=1}^Na^**iy\_i\color{red}{K(x\_i,x)} + y\_j - \sum*{i=1}^Ny\_ia^*\_i\color{red}{K(x\_i, x\_j)}) && {4}
\end{aligned}
$$


---

# 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://windmising.gitbook.io/lihang-tongjixuexifangfa/11/13.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.
