Add. Maximum entropy model

pull/2/head
benjas 6 years ago
parent e28be495d9
commit 4b4ee86a79

@ -92,3 +92,123 @@ Summarization
A story about the Maximum entropy model
我们去到拉斯维加斯赌场
问1:我手里有个骰子,问你扔下去后某个面朝上的概率是多少?
答1:都是1/6,因为概率相同
问2:我竟然认为有道理,可如果是老千手里的骰子呢?你还觉得是1/6吗?
答2:可是你没说是老千手里的
问3:可是为什么你不去假设可能是老千手里的骰子这种情况?
答3:因为你没说是老千手里的
问4:好像是这么个道理,如果要考虑老千,那可能还要考虑骰子是否破损,桌面是否有问题
答4:所以1/6最保险
问5:如果我告诉你,1朝上的概率是1/2呢?
答5:那剩下的就是1/10
**什么是最大熵?**
在我们猜测概率时,不确定的部分我们认为是等可能的,就像骰子一样,我们知道有6个面,因此认为每个面的概率是1/6,也就是等可能。
换句话说,就是趋向于均匀分布,最大熵使用的就是这么朴素的道理:
​ 凡是我们知道的,就把它考虑进去,凡是不知道的,通通均匀分布。
### 最大熵模型
Maximum entropy model
终极目标:P(Y|X)
熵:![1619102072918](assets/1619102072918.png)
将终极目标代入熵:
![1619102101155](assets/1619102101155.png)
做些改变,调整熵:
![1619102153364](assets/1619102153364.png)
我们手里有训练集,包含所有样本及对应的标签。
![1619102378061](assets/1619102378061.png)
> v表示数目,满足X=x,Y=y的数目
>
> 统计出来概率,通过频数
![1619102385980](assets/1619102385980.png)
**特征函数**
其作用是为了将某个特征x,进行一些转换后,让它和标签y起到重大的相关作用
![1619102621448](assets/1619102621448.png)
特征函数f(x,y)关于经验分布,![1619102676233](assets/1619102676233.png)的期望值:
![1619102692422](assets/1619102692422.png)
特征函数f(x,y)关于模型P(Y|X)与经验分布![1619102890428](assets/1619102890428.png)的期望值:
![1619102909494](assets/1619102909494.png)
> 下面的P表示真实世界中全部数据的分布,即训练集不可能用上全部的数据,一般都是某段时间的,比如N年,所以用![1619103339948](assets/1619103339948.png)表示它是真实的全部时间P中的某段的经验分布
约束:![1619103420910](assets/1619103420910.png)
> 希望训练集的和真实的全部数据是一致的分布
max
![1619103794313](assets/1619103794313.png)
![1619103711622](assets/1619103711622.png)
> fi表示让所有的特征都满足约束条件
min
![1619103835595](assets/1619103835595.png)
![1619103802671](assets/1619103802671.png)
**拉格朗日乘子法:**
![1619103884422](assets/1619103884422.png)
![1619103914972](assets/1619103914972.png)
> 求最小的值
![1619103936518](assets/1619103936518.png)
![1619103949860](assets/1619103949860.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Loading…
Cancel
Save