> For the complete documentation index, see [llms.txt](https://aye10032.gitbook.io/prml-note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aye10032.gitbook.io/prml-note/di-liu-zhang-you-jian-du-xue-xi/6.1-you-jian-du-xue-xi.md).

# 6.1 有监督学习

## 6.1.1 什么是有监督学习

{% hint style="success" %}
从<mark style="color:orange;">**有标记**</mark>的训练数据中学习推断函数。
{% endhint %}

* 有监督学习算法分析训练数据，产生<mark style="color:purple;">**推断函数**</mark>
* 推断函数能够对新的样本进行预测
* **最优的情形**：算法能够准确地对**没见过**的样本进行正确地分类
* <mark style="color:purple;">**目标函数（target function）**</mark> ：$$y=f(x)$$ 或 $$P(y\vert x)$$

## 6.1.2 有监督学习的主要方法

### 一、产生式模型

* 首先对联合分布进行推断：

$$
p(x,y) = p(y)p(x\vert y)
$$

> 其中$$p(y)$$为<mark style="color:purple;">**先验概率**</mark>，一半来自频次等等信息

* 接下来使用贝叶斯定理计算<mark style="color:purple;">**目标函数**</mark>条件分布$$p(y\vert x)$$

$$
\begin{align} p(y\vert x) &=\frac{p(x,y)}{p(y)} \notag \ & = \frac{p(y)p(x\vert y)}{\int p(y)p(x\vert y)dy} \notag \end{align}
$$

* 最后使用这个条件概率密度来进行预测

{% hint style="success" %}
要确定某人所说语言的类别，产生式模型先学习所有语言，然后进行预测
{% endhint %}

### 二、判别式模型

* 直接估计出概率分布$$P(y\vert x)$$或条件概率密度函数$$p(y\vert x)$$
* 根据估计的函数确定输出

{% hint style="success" %}
要确定某人所说语言的类别，判别式模型在不学习任何语言的情况下判别别语言的差异
{% endhint %}

### 三、判别函数

* 寻找一个函数$$f(x)$$，将每个输入直接映射到目标输出
* 概率不起直接作用
  * 不能直接获取后验概率
  * $$f(x)$$的目的通常旨在近似条件分布$$p(y\vert x)$$
