[关闭]
@nrailgun 2015-10-02T20:41:31.000000Z 字数 1825 阅读 1530

朴素贝叶斯分类

机器学习


Bayes Theorem

Let A and B denotes 2 independent random variables. Then we have:

P(AB)=P(BA)×P(A)P(B),

where P(A) and P(B) is corresponding probability.


Naive Bayes Classification

Let input space be XRn, and output space be Y={c1,c2,,ck}. Conditional probability distribution P(X=xY=ck) has Knj=1Sj parameters. Almost impossible to calculate them all.

Suppose all x(l) are independent, the distribution will be:

P(X=xY=ck)=j=1nP(X(j)=x(j)Y=ck).

Well, we have:

P(Y=ckX=x)=P(X=xY=ck)P(Y=ck)P(X=x),

where P(X=x) is the same for any ck.

Finally, Naive Bayes Classification can be represented as:

y=f(x)=argmaxckP(Y=ck)jP(X(j)=x(j)Y=ck).


Paramters Estimate

Maximum Likelihood Estimate

The probability of P(Y=ck)

P(Y=ck)=Ni=1I(yi=ci)N,k=1,2,,K.

The probability of P(X(j)=aY=cj) is

P(X(j)=aY=cj)=Ni=1I(X(j)=a,yi=ck)Ni=1I(yi=ck).

Bayes Estimate

P(X(j)=aY=ck) might be 0 for some a, which causes classification errors. Use Bayes Estimate instead.

The Bayes estimate of conditional probability is:

Pλ(X(j)=aY=cj)=Ni=1I(X(j)=a,yi=ck)+λNi=1I(yi=ck)+Sjλ,

where Sj is the size of X(j) space, and usually λ=1.

The Bayes estimate of P(Y=ck) is:

P(Y=ck)=Ni=1I(yi=ci)+λN+Kλ,k=1,2,,K.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注