|
@@ -12,7 +12,6 @@ $$p_{(\boldsymbol x_{i}| c)}$$
|
|
|
[解析]:式(7.17)所得$P_{(\boldsymbol x_{i}|c)}\in[0,1]$为条件概率,但式(7.18)所得$p_{(\boldsymbol x_{i}| c)}$为条件概率密度而非概率,其值并不在局限于区间[0,1]之内。
|
|
[解析]:式(7.17)所得$P_{(\boldsymbol x_{i}|c)}\in[0,1]$为条件概率,但式(7.18)所得$p_{(\boldsymbol x_{i}| c)}$为条件概率密度而非概率,其值并不在局限于区间[0,1]之内。
|
|
|
|
|
|
|
|
## 7.23
|
|
## 7.23
|
|
|
-
|
|
|
|
|
$$P(c|\boldsymbol x)\propto{\sum_{i=1 \atop |D_{x_{i}}|\geq m'}^{d}}P(c,x_{i})\prod_{j=1}^{d}P(x_j|c,x_i)$$
|
|
$$P(c|\boldsymbol x)\propto{\sum_{i=1 \atop |D_{x_{i}}|\geq m'}^{d}}P(c,x_{i})\prod_{j=1}^{d}P(x_j|c,x_i)$$
|
|
|
[推导]:
|
|
[推导]:
|
|
|
$$\begin{aligned}
|
|
$$\begin{aligned}
|
|
@@ -33,31 +32,4 @@ $$P(c|\boldsymbol x)\propto{\sum_{i=1 \atop |D_{x_{i}}|\geq m'}^{d}}P(c,x_{i})\p
|
|
|
|
|
|
|
|
## 附录
|
|
## 附录
|
|
|
### 勘误
|
|
### 勘误
|
|
|
-7.3节例子计算有笔误,第152页的第9个等式应为$P_{(凹陷|\boldsymbol 是)}=\cfrac{5}{8}$。截止到目前(第28次印刷),西瓜书官方勘误修订仅在第8次印刷时修正了第3个等式$P_{(蜷缩|\boldsymbol 是)}$,但第9个等式仍未修正(若修正第84页的西瓜数据集3.0也可,但亦未修正)。
|
|
|
|
|
-
|
|
|
|
|
-#### sklearn调包
|
|
|
|
|
-
|
|
|
|
|
-```python
|
|
|
|
|
- import numpy as np
|
|
|
|
|
- X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
|
|
|
|
|
- Y = np.array([1, 1, 1, 2, 2, 2])
|
|
|
|
|
-from sklearn.naive_bayes import GaussianNB
|
|
|
|
|
- clf = GaussianNB()
|
|
|
|
|
-clf.fit(X, Y)
|
|
|
|
|
-GaussianNB(priors=None, var_smoothing=1e-09)
|
|
|
|
|
-print(clf.predict([[-0.8, -1]]))
|
|
|
|
|
-```
|
|
|
|
|
-#### 参数:
|
|
|
|
|
-priors : array-like, shape (n_classes,)
|
|
|
|
|
-Prior probabilities of the classes. If specified the priors are not adjusted according to the data.
|
|
|
|
|
-
|
|
|
|
|
-var_smoothing : float, optional (default=1e-9)
|
|
|
|
|
-Portion of the largest variance of all features that is added to variances for calculation stability.
|
|
|
|
|
-#### 贝叶斯应用
|
|
|
|
|
-
|
|
|
|
|
-1. 中文分词
|
|
|
|
|
-分词后,得分的假设是基于两词之间是独立的,后词的出现与前词无关
|
|
|
|
|
-2. 统计机器翻译
|
|
|
|
|
-统计机器翻译因为其简单,无需手动添加规则,迅速成为了机器翻译的事实标准。
|
|
|
|
|
-3. 贝叶斯图像识别
|
|
|
|
|
-首先是视觉系统提取图形的边角特征,然后使用这些特征自底向上地激活高层的抽象概念,然后使用一个自顶向下的验证来比较到底哪个概念最佳地解释了观察到的图像。
|
|
|
|
|
|
|
+7.3节例子计算有笔误,第152页的第9个等式应为$P_{(凹陷|\boldsymbol 是)}=\cfrac{5}{8}$。截止到目前(第28次印刷),西瓜书官方勘误修订仅在第8次印刷时修正了第3个等式$P_{(蜷缩|\boldsymbol 是)}$,但第9个等式仍未修正(若修正第84页的西瓜数据集3.0也可,但亦未修正)。
|