{"id":1908,"date":"2019-04-17T12:00:00","date_gmt":"2019-04-17T10:00:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/machine-learning-101-the-bayes-classfier\/"},"modified":"2026-07-05T03:22:58","modified_gmt":"2026-07-05T01:22:58","slug":"machine-learning-101-the-bayes-classfier","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/machine-learning-101-the-bayes-classfier\/","title":{"rendered":"Machine Learning 101 \u2013 The Bayes\u2019 Classfier"},"content":{"rendered":"<p>This is the second lecture on classification. It follow the first one: <a href=\"https:\/\/kindsonthegenius.com\/tempsite\/machine-learning-101-introduction-to-classification\/\">Introduction to Classification<\/a>.<\/p>\n<p><strong>Bayes&#8217; Classifier<\/strong> is a classifier that works based on Bayes&#8217; Theorem. It assigns each observation to the most likely class given the values of the measurements.<\/p>\n<p>Also remember that Bayes&#8217; theorem helps us compute conditional probabilities. So a Bayes&#8217; classifier determines the conditional probability for the particular class given the features.<\/p>\n<p>&nbsp;<\/p>\n<p><em>Let&#8217;s take the X-ray example.<\/em><\/p>\n<p>When an X-ray image of the patient is obtained, the objective is to decide which of the two classes to assign it.\u00a0 Either C<sub>1<\/sub> or C<sub>2<\/sub>.<\/p>\n<p>There for we need to compute the conditional probabilities of the classes C<sub>1<\/sub> and C<sub>2<\/sub> given the image.\u00a0 Let&#8217;s say C<sub>k<\/sub>, where k=1, 2.<\/p>\n<p>The conditional probabilities is given by:<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-743 aligncenter\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2020\/09\/Bayes-Classifier-300x74.jpg\" alt=\"Bayes' Classifier\" width=\"300\" height=\"74\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>In this equation:<\/p>\n<p>P(C<sub>k<\/sub>) is the prior probability for the class C<sub>k<\/sub>. This is because the probability is know prior to taking the X-ray.<\/p>\n<p>P(C<sub>k<\/sub> | <strong>x<\/strong>) is the corresponding posterior probability. This is the probability of C<sub>k<\/sub> after taking the X-ray. That is after <strong>x<\/strong> has been determined.<\/p>\n<p>If the objective is to reduce the chance of assigning x to the wrong class, then we would choose the class that have the higher posterior probability.<\/p>\n<p>In the case of two-class problem we just discussed, then Bayes&#8217; classifier corresponds to trying to predict\u00a0 has P(C<sub>k<\/sub> | <strong>x<\/strong>) &gt; 0.5. Therefore the corresponding posterior probability would be &lt; 0.5<\/p>\n<p>Since we know that P(C<sub>1<\/sub> | <strong>x<\/strong>) + P(C<sub>2<\/sub> | <strong>x<\/strong>) = 1.<\/p>\n<p>&nbsp;<\/p>\n<p>Bayes&#8217; classifier is know to do pretty good job in classification. However, there are times when misclassification occurs.<\/p>\n<p>We would end this lesson here so in the next lesson, we discuss how to minimize misclassification rate in Bayes&#8217; classifier.<\/p>\n<p>&nbsp;<\/p>\n<p>You could read up <a href=\"https:\/\/kindsonthegenius.com\/tempsite\/conditional-probability-introduction-to-bayes-rule\/\">Basics of Conditional Probability<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the second lecture on classification. It follow the first one: Introduction to Classification. Bayes&#8217; Classifier is a classifier that works based on Bayes&#8217; &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[16],"tags":[],"class_list":["post-1908","post","type-post","status-publish","format-standard","hentry","category-machine-learning"],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1908","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=1908"}],"version-history":[{"count":1,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1908\/revisions"}],"predecessor-version":[{"id":2076,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1908\/revisions\/2076"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=1908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=1908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=1908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}