Lecture Slide 03 - Bayesian Classifier - Summer 2023
Lecture Slide 03 - Bayesian Classifier - Summer 2023
Bayes’ Theorem:
needs to be maximized
Does patient have cancer or not?
A patient takes a lab test and the result comes back positive. It is
known that the test returns a correct positive result in only 99% of
the cases and a correct negative result in only 95% of the cases.
Furthermore, only 0.03 of the entire population has this disease.
Letting
s be the proposition that the patient has a stiff neck and
m be the proposition that the patient has meningitis, we have
Bayesian Methods
Learning and classification methods based on
probability theory.
Bayes theorem plays a critical role in probabilistic
learning and classification.
Uses prior probability of each category given no
information about an item.
Categorization produces a posterior probability
distribution over the possible categories given a
description of an item.
Bayes Classifiers
Assumption: training set consists of instances of different classes
described cj as conjunctions of attributes values
Task: Classify a new instance d based on a tuple of attribute values
into one of the classes cj C
Key idea: assign the most probable class using Bayes
Theorem.
Naïve Bayes Classifier
This greatly reduces the computation cost: Only counts the class
distribution
If A is categorical, P(x |C ) is the # of tuples in C having value
k k i i
xk for Ak divided by |Ci, D| (# of tuples of Ci in D)
If A is continous-valued, P(x |C ) is usually computed based on
k k i
Gaussian distribution with a mean μ and standard deviation σ
and P(xk|Ci) is
Parameters estimation
P(cj)
Can be estimated from the frequency of classes in the
training examples.
P(x1,x2,…,xn|cj)
O(|X|n•|C|) parameters
Could only be estimated if a very, very large number of
training examples was available.
Independence Assumption: attribute values are conditionally
independent given the target value: naïve Bayes.
Naïve Bayes Classifier: Training Dataset
Class:
C1:buys_computer = ‘yes’
C2:buys_computer = ‘no’
Data to be classified:
X = (age <=30,
Income = medium,
Student = yes
Credit_rating = Fair)
Naïve Bayes Classifier: An Example
P(C ): P(buys_computer = “yes”) = 9/14 = 0.643
i
Log odds:
Discriminant Functions
Advantages
Easy to implement
Good results obtained in most of the cases
Disadvantages
Assumption: class conditional independence, therefore loss of
accuracy
Practically, dependencies exist among variables
E.g., hospitals: patients: Profile: age, family history, etc.
Symptoms: fever, cough etc., Disease: lung cancer, diabetes,
etc.
Dependencies among these cannot be modeled by Naïve Bayes Classifier
Project Proposal Submission Instructions
Submit hard copy of project proposal on xx-xx-2023
in the class time. One copy for one group.
A short presentation (5-7 minutes) on the proposal xx-
xx-2023 Class Time to explain what has to be done.
One person is fine to present, but all members must
attend in the Q&N session.
Report has to submit with apocopate cover page with
all members information. Team also need to propose a
Group Name, e.g., Group ML Learners
Textbook/ Reference Materials