Conditional Probability
Joint Probability
Considering 2 events A and B, the probability that both occur
together is
Events A and B are independent iff
A set of events
is independent iff for every finite subset J
I,
Eg: Flipping a coin twice, with
A = {Heads on first flip}, B = {Heads on second flip}
Then
Conditional Probability
Suppose some event B has occured, and the event of interest is
A,
the conditional probability of A given B is
If
are disjoint, then
By dividing by
,
we normalise the universe to just B. When A occurs in this universe, B
must also occur, hence we take
.
If A and B are independent,
.
Multiplicative Rule
Following from the definition of conditional probaility, we have
For independent events A and B,
Extending to multiple events,
Law of Total
Probability
Let
be a partition of sample space
.
(i.e.
)
Then for any event A,
i.e. P(A) is the sum of
probabilities in each scenario, weighted by each scenario’s
probability.
Bayes’ Theorem
For
,
Derivation: By Multiplicative Rule,
Rearranging, we get Bayes’ Theorem.
Naive Bayes classifier
Applications in supervised learning.
Goal: Classify an input (some object, e.g. an email,
image, etc.) into one of several classes using probability.
Let
be a class label (e.g. spam/not spam), and
be observed features (certain words in the email).
By Bayes’ Theorem,
To find the classifier
Here,
refers to finding the class
that maximises the probability of the class given the data.
This is proportional to
.
We can ignore the denominator
,
which is a constant for all classes,
,
during the maximisation process.
From the labelled data, it is easy to find
.
The challenge is to find
The assumption of Naive Bayes is that all features
are conditionally independent, given the class.
Then, we have
The Naive Bayes classifier is now
Example calculation of an email spam filter:
From the data, we have
Given an input feature {"free", "offer", "click"}
,
For class
= spam,
For class
= not spam,
Conclusion: Likely spam.