Bayes Theorem

Bayes' Theorem

Bayes’ Theorem states that $$ p(F | E) = \frac{p(E|F)p(F)}{p(E|F)p(F) + p(E|\bar F)p(\bar F)} $$

Short form:

Link to original

Bayesian learning

no clue what's going on here

Maximum a posteriori (MAP) hypothesis:

In some cases we assume that every hypothesis is equally likely a priori. Then we only need to consider the likelihood .

In this case, we want the maximum likelihood hypothesis :

Naive Bayes classifier

Practical approach to Bayesian learning, it is simple but effective and particularly resistant to overfitting because of its simplicity.

As a classifier, it fits the mould of: where we learn an approximation of the mapping to :

takes on values from a finite set (target value) is a tuple / vector of feature values:

In this setting, a new instance is classified by looking for: which Bayes’ theorem allows us to re-write as: We can estimate these values based on training data.

  • is based on number of times appears in training data
  • is the proportion of case that have which also have

Number of possible combinations is large, you need to see them many times to get good estimates, so we need a lot of data to train.

So we need to simplify (Naive Bayes Assumption):

  1. assume position does not matter (if applicable)
  2. assume that features are conditionally independent given the target (strong independence assumption)

  • : look for all cases in which occurs and then compute the proportion which have
  • need much less data to be accurate

After calculating and the , we can make predictions about the for a given .

When the assumption about conditional independence is satisfied, .

We can prove this. However, when it is not satisfied, is often a good solution which we can establish by experimentation.

Small probabilities

With more features we can easily get underflow errors, we avoid this by taking logs:

Estimating probabilities

So far we’ve computed probabilities by counting, e.g. estimate by:

Good estimate most of the time but can be poor when is close to zero, which can happen if we only have a few samples. This can lead to overfitting.

We can instead find the -estimate:

  • is a prior estimate (before taking any data into account) Typical value of is if the feature has values
  • is a constant, equivalent sample size (weight given to prior)

Slide 59-61 useless or gay porn?

Gaussian mixture models

Given a dataset of non-anomalous instances, is a new anomalous? We model to detect anomalous cases: .

Might model each feature as a Gaussian distribution with mean and variance . Often, the data we are trying to model is much more complex.

A mixture model is a combination of probability models:

Univariate Gaussian mixtureMultivariate Gaussian mixture

In the general case, we mix base distributions (of any type) so that:

where are the mixing weights.

In other words, probability of an element is the sum of probabilities assigned to by each of the probability models in the mixture.

Most widely used mixture model is probably the mixture of Gaussians. Each model is a multivariate Gaussian with mean and covariance (matrix ). The mixture is: which just assigns the sum of the probabilities given to it by each of the components.

When all Gaussians are univariate, we have: Where is the variance.

Example: modelling human height

We can’t just fit a single Gaussian as it doesn’t properly represent the data

Why is this useful?

  • Lots of processes are Gaussian: lots of stuff in the world generates normally distributed data.
  • Combinations of these things will be mixture models.

EM algorithm

Estimating means of k Gaussians

Assume is generated by a mixture model. Pick a distribution with equal probability then pick a value according to the distribution. Then repeat.

slides 71-86

K-means clustering

k-Means Clustering

Say we have points . We want to partition them into sets such that the cost of the partition is minimised, :

Where is the mid-point of each cluster, i.e. .

Where is the squared L2 norm (squared Euclidian distance).

Link to original

There are two types of K-means clustering:

  • hard clustering: reports which cluster is part of
  • soft clustering: probability that is in the cluster

0 items under this folder.