《(4.2.1)--4.2NaiveBayes.pdf》由会员分享,可在线阅读,更多相关《(4.2.1)--4.2NaiveBayes.pdf(7页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、What is Nave Bayes ClassifierNaive Bayesis a classification algorithm basedon Bayes Theorem with an assumption ofindependence among predictors.NaveBayesWhat is Bayes TheoremBayes theoremdescribes the probabilityof an event,based on prior knowledge ofconditions that might be related to theevent.The p
2、osterior probability equals the prior probability times the likelihood ratio.Prior ProbabilityPosterior ProbabilityLikelihood RatioHow Bayes Theorem WorksA shepherd boy gets bored tending the towns flock.To havesome fun,he cries out,Wolf!even though no wolf is in sight.The villagers run to protect t
3、he flock,but then get really madwhen they realize the boy was playing a joke on them.A few days afterwards he tries the same trick.One day,the shepherd boy sees a real wolf approaching theflock and calls out,Wolf!The villagers refuse to be fooledagain and stay in their houses.The hungry wolf turns t
4、he flockinto lamb chops.The town goes hungry.How to use Bayes Theorem to explain the decline of villagers trust in the child?How Bayes Theorem Works=The boy lies,=Villagers trust the boy The villagers trust in the boy in the past is =0.8The probability of the boy lying when the villagers believe the
5、 boy is|=0.1|indicates the villagers trust in the child after the child tells a lie.Suppose:The probability of the boy lying is =0.2=0.1 0.80.2 =)(|)()(=0.4Predicting Using Naive BayesDayOutlookHumidityWindPlay1SunnyHighWeakNo2SunnyHighStrongNo3OvercastHighWeakYes4RainHighWeakYes5RainNormalWeakYes6R
6、ainNormalStrongNo7OvercastNormalStrongYes8SunnyHighWeakNo9SunnyNormalWeakYes10RainNormalWeakYes11SunnyNormalStrongYes12OvercastHighStrongYes13OvercastNormalWeakYes14RainHighStrongNoFrequency TablePlayYesNoOutlookSunny32Overcast40Rainy32Frequency TablePlayYesNoHumidityHigh34Normal61Frequency TablePla
7、yYesNoWindStrong62Weak33Likelihood TablePlayYesNoOutlookSunny3/102/45/14Overcast4/100/44/14Rain3/102/45/1410/144/14()=()=10/14()=()=5/14 =()/()=0.6Likelihood TablePlayYesNoHumidityHigh3/94/57/14Normal6/91/57/149/145/14 =3/10Likelihood TablePlayYesNoWindWeak6/92/58/14Strong3/93/56/149/145/14 =()/()=0.43 =()/()=0.75Calculating conditional probability of play on the following combination of Outlook,Humidity and Wind:Where E equals:Outlook=RainHumidity=HighWind=WeakLet H=No Play =,=()=(24)(45)(25)(514)(514)(714)(814)=0.56