Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
learning511 authored May 22, 2019
1 parent fc8b688 commit be24a2a
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions 李宏毅机器学习-作业/week4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,3 @@ Barry Becker从1994年的人口普查数据库中进行了提取。
在这作业我们将所有的训练资料中的20%当成验证集,由另外80%的资料集来训练参数。并使用 Mini-batch Gradient Descent 演算法来训练逻辑式回归的参数W和B,门槛值则用最一般的方式设置0.5。由下图可以清楚的看出随著叠代次数越来越多,不论是训练集或是验证集的 Cross entropy 都越来越小,且趋近于一致。这也就说明了模型参数学习得不错。最后在测试集的预测精准度为85%。

![](02-Output/TrainProcess.png)

### Probabilstic Generative Model

由于我们的目标是将资料进行二元分类,可以假设年收入大于50(y=1)为<img src="https://latex.codecogs.com/gif.latex?C_{1}" title="C_{1}" />类别和年收入小于50(y=0)为<img src="https://latex.codecogs.com/gif.latex?C_{2}" title="C_{2}" />类别且各为106维的常态分配,且每个特征是独立的,其中变异数矩阵共用,最后由最大估计法直接计算参数<img src="https://latex.codecogs.com/gif.latex?\mu&space;_{1},&space;\mu&space;_{2},&space;\Sigma" title="\mu _{1}, \mu _{2}, \Sigma" />的最佳解。

拥有了模型的参数,我们藉由机率的方式来决定资料是属于哪个类别,也就是说,分别计算资料来自于第一类的机率<img src="https://latex.codecogs.com/gif.latex?P(C_{1})" title="P(C_{1})" />和第二类的机率<img src="https://latex.codecogs.com/gif.latex?P\left&space;(C_{2}&space;\right&space;)" title="P\left (C_{2} \right )" />以及资料在第一类的机率<img src="https://latex.codecogs.com/gif.latex?P(x\mid&space;C_{1})" title="P(x\mid C_{1})" />和第二类的机率<img src="https://latex.codecogs.com/gif.latex?P(x\mid&space;C_{2})" title="P(x\mid C_{2})" />,最后藉由上述这些机率去计算资料属于第一类的机率<img src="https://latex.codecogs.com/gif.latex?P(x\mid&space;C_{1})=&space;\frac{P(x\mid&space;C_{1})P(C_{1})}{P(x\mid&space;C_{1})P(C_{1})&plus;P(x\mid&space;C_{2})P(C_{2})}" title="P(x\mid C_{1})= \frac{P(x\mid C_{1})P(C_{1})}{P(x\mid C_{1})P(C_{1})+P(x\mid C_{2})P(C_{2})}" />和第二类的机率<img src="https://latex.codecogs.com/gif.latex?1-P(x\mid&space;C_{1})" title="1-P(x\mid C_{1})" />,最后藉此机率决定资料类别。

在此作业我们假设资料来自于常态分配,主要的原因还是因为数学推导相对而言比较简单加上常态分配相对而言比较直观,当然要假设其他机率分配也是可行的,例如像是0和1的类别资料,假设百努力分配相对于常态分配就会比较合理,另外假设每个特徵是独立的也就是使用 Naive Bayes Classifier。

在这 case 底下我们的预测精准度大约76%,相对于 discriminative model 的 Logistic Regression 略差一些。另外我们做了很多的假设,像是资料来自于两个常态分配且变异数矩阵使用相同的参数,以及特徵之间是独立,但可能这些资料并不符合这些假设,这也是这个模型的预测率相对于 Logistic Regression 差的原因。

0 comments on commit be24a2a

Please sign in to comment.