Docsity

Bayesian Classifiers: Probabilistic Approach to Instance Classification, Slides of Computer Science

Partial preview of the text

Download Bayesian Classifiers: Probabilistic Approach to Instance Classification and more Slides Computer Science in PDF only on Docsity!

Bayesian classifiers

By

Mustafa Majeed

Supervisor

Prof.Dr. Ahmed Tariq

Bayesian

 The idea behind a Bayesian classifier is

that, if an agent knows the class, it can

predict the values of the other features. If

it does not know the class, Bayes' rule can

be used to predict the class given (some

of) the feature values.

Bayesian Classification: Why?

 (^) Probabilistic learning: Calculate explicit probabilities for hypothesis, among the most practical approaches to certain types of learning problems  (^) Incremental: Each training example can incrementally increase/decrease the probability that a hypothesis is correct. Prior knowledge can be combined with observed data.  (^) Probabilistic prediction: Predict multiple hypotheses, weighted by their probabilities.  (^) Standard: Even when Bayesian methods are computationally intractable, they can provide a standard of optimal decision making against which other methods can be measured.

Bayesian Theorem

 (^) Given training data D, posteriori probability of a hypothesis h, P(h|D) follows the Bayes theorem  (^) MAP (maximum posteriori) hypothesis  (^) Practical difficulty: require initial knowledge of many probabilities, significant computational cost ( ) ( | ) ( ) ( | ) P D P D h P h P h D  arg max ( | ) argmax P ( D | h ) P ( h ). h H P h D h H MAP h    

Bayesian Networks

 (^) • Bayesian Networks(BNs) are graphical models for reasoning under un certainty, where the nodes represent variables (discrete or continuous) and arcs represent direct connections between them.  (^) • The nodes in a Bayesian network represent a set of random variables ,X=X1;...Xi;…Xn ,from the domain.  (^) • A set of directed arcs(or links) connects pairs of nodes ,XiXj, representing the direct Xj, representing the direct dependencies between variables.  (^) • The structure, or topology, of the network should capture qualitative relationships between variables. In particular, two nodes should be

Medical Diagnosis Example

 • We might ask what factors affect

apatient’s chance of having cancer? If the

answer is “Pollution and smoking,” then

we should add arcs from Pollution and

Smoker to Cancer.

 • Cancer will affect the patient’s breathing

and the chances of having a positive X-ray

result. So we add arcs from Cancer to

Dyspnoea and XRay.

Methods Used in Bayesian Networks

 • Naïve Bayesian Classifier

 • Tan Bayesian Network Classifier

 • K2 Bayesian Network

Naïve Bayesian Classification

Naïve Bayesian Classification

 4- it would be extremely computationally

expensive to compute P(X | Ci )

  • A simplified assumption: attributes are

class conditional independence (i.e., no

dependence relation between attributes)

  • Thus:

This greatly reduces the computation cost:

Only counts the class distribution

Naïve Bayesian Classification

Algorithm naïve bayes

Naive Bayesian Classifier

 (^) Given a training set, we can compute the probabilities Outlook P N Humidity P N sunny 2/9 3/5 high 3/9 4/ overcast 4/9 0 normal 6/9 1/ rain 3/9 2/ Tempreature Windy hot 2/9 2/5 true 3/9 3/ mild 4/9 2/5 false 6/9 2/ cool 3/9 1/

Play-tennis example: classifying X

 An unseen sample X = <rain, hot, high,

false>

 P(X|p)·P(p) = P(rain|p)·P(hot|p)·P(high|

p)·P(false|p)·P(p) = 3/9·2/9·3/9·6/9·9/14 =

 P(X|n)·P(n) =

P(rain|n)·P(hot|n)·P(high|n)·P(false|n)·P(n)

 Sample X is classified in class n (don’t

play)