CS229 Lecture Notes(4): Generative Learning Algorithm

Generative Learning Algorithm

  • discriminative learning algorithm: Algorithms try to learn p(y|x) directly or try to learn mappings f(x) directly from the space of inputs to the labels y

  • generative learning algorithm: Algorithms try to model p(x|y) and prior distribution p(y) , and use Bayes rule to derive the posterior distribution p(y|x) :

    p(y|x)=p(x|y)p(y)p(x)p(x|y)p(y)

    and predict y as:
    y=argmaxyp(y|x)=argmaxyp(x|y)p(y)

    Bayes法则在统计机器学习中有很多应用场景。除了出现在这里的生成式学习模型,对于Bayes学派而言,Bayes法则还可以用于模型的参数估计,以及模型的选择。(参见PRML第三章的学习笔记)

Gaussian Discriminant Analysis

  • multivariate normal distribution

    • p(x;μ,Σ)=1(2π)n/2|Σ|1/2exp(12(xμ)TΣ1(xμ))
      where:
      • μn is the mean vector
      • Σn×n is the covariance matrix
    • E[X]=xxp(x;μ,Σ)dx=μ
    • Cov[X]=E[XXT]E[X]E[X]T=Σ
  • GDA models

    • solving classification problems with continuous-valued feature
    • model assumption:

      • p(y)Bernoulli(ϕ)
      • p(x|y=k)(μk,Σ),k{0,1}

      注意:在模型中我们假定了不同label下的feature共享着同一个协方差矩阵,尽管它们有着不一样的均值。

    • likelihood function:

      l(ϕ,{μk},Σ)=logi=1mp(x(i),y(i);ϕ,{μk},Σ)=logi=1mp(x(i)|y(i));{μk},Σ)p(y(i);ϕ)

      区别于判别式模型,生成式模型的似然函数是对整个数据集的联合概率分布 p(x,y) 进行计算。

    • maximum likelihood estimation:

      • ϕ=1mmi=11(y(i)=1)
      • μk=mean(x|y=k)=mi=11{y(i)=k}x(i)mi=11{y(i)=k}
      • Σ=1mmi=1(x(i)uy(i))(x(i)uy(i))T

      直观上来看,最大似然法给出的GDA模型参数的预估结果可以用简单的频率统计来理解。例如, ϕ 就是正样本 y(i)=1 占整体样本的比例; μk 就是 x 在某一类label(y(i)=k)上的均值。

    • decision boundary:

      p(y=1|x)=p(x,y=1)p(x,y=0)+p(x,y=1)=0.5

      which equals with:
      p(x,y=0)=p(x,y=1)

      这里的decision boundary也可以理解为是两个概率分布相交的平面。

  • GDA model vs. logistic regression model

    • GDA model could be expressed in the form of logistic regression model with:
      • θ is parameterized by ϕ , {μk} , and Σ
      • ϕ , {μk} , and Σ are determined by GDA assumptions
    • GDA model:
      1. stronger assumptions: p(x|y) is multivariate gaussian with shared Σ
      2. more efficient if these assumptions are correct
    • logistic regression:
      1. weaker assumptions
      2. more robust

    GDA给出的 p(y|x) 概率模型,本质上是一个更强假定下的logistic function。但反过来,从logistic function不一定能推出GDA模型的假定。事实上,如果我们认为 p(x|y) 服从一个泊松分布,也一样能得到logistic function形式的 p(y|x) 。因此,logistic regression在实际应用中是一类更为通用的算法。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值