Professional Documents
Culture Documents
Naive Bayes
Naive Bayes
Naive Bayes
UNIT-II
• Estimating Probabilities from Data, Bayes Rule, MLE, MAP
• Naive Bayes: Conditional Independence, Naive Bayes: Why
and How, Bag of Words
• Logistic Regression : Maximizing Conditional likelihood ,
Gradient Descent
• Kernels: Kernalization Algorithm, Kernalizing Perceptoron.
• Discriminants: The Perceptron, Linear Separability, Linear
Regression
• Multilayer Perceptron (MLP): Going Forwards, Backwards,
MLP in practices, Deriving back Propagation.
BAYESIAN LEARNING
• Bayesian reasoning provides a probabilistic approach to inference. It
is based on the assumption that the quantities of interest are
governed by probability distributions and that optimal decisions can
be made by reasoning about these probabilities together with
observed data.
• It is important to machine learning because it provides a
quantitative approach to weighing the evidence supporting
alternative hypotheses.
• Bayesian reasoning provides the basis for learning algorithms that
directly manipulate probabilities, as well as a framework for
analyzing the operation of other algorithms that do not explicitly
manipulate probabilities.
• Bayesian learning methods are relevant to our study of machine
learning for two different reasons.
• Bayesian learning algorithms calculate explicit probabilities for
hypotheses, such as the naive Bayes classifier.
• Naive Bayes classifier is competitive with other learning algorithms
(Decision Tree and Neural Network Algorithms).
• Bayesian methods are important for study of machine learning is
that they provide a useful perspective for understanding many
learning algorithms that do not explicitly manipulate probabilities.
Ex.: Analyze algorithms FIND-S and CANDIDATEELIMINATION
algorithms to determine conditions under which they output the most
probable hypothesis given the training data.
Use a Bayesian analysis to justify a key design choice in neural network
learning algorithms: choosing to minimize the sum of squared errors
when searching the space of possible neural networks.
• Derive an alternative error function, cross entropy, i.e. more
appropriate than sum of squared errors when learning target
functions that predict probabilities.
Features of Bayesian learning methods include:
• Each observed training example can incrementally decrease or
increase the estimated probability that a hypothesis is correct. This
provides a more flexible approach to learning than algorithms that
completely eliminate a hypothesis if it is found to be inconsistent with
any single example.
• Prior knowledge can be combined with observed data to determine
the final probability of a hypothesis. In Bayesian learning, prior
knowledge is provided by asserting (1) a prior probability for each
candidate hypothesis, and (2) a probability distribution over observed
data for each possible hypothesis.
• Bayesian methods can accommodate hypotheses that make
probabilistic predictions (e.g., hypotheses such as "this pneumonia
patient has a 93% chance of complete recovery").
• New instances can be classified by combining the predictions of multiple
hypotheses, weighted by their probabilities.
• Even in cases where Bayesian methods prove computationally intractable, they can
provide a standard of optimal decision making against which other practical
methods can be measured.
• One practical difficulty in applying Bayesian methods is that they typically require
initial knowledge of many probabilities.
• A second practical difficulty is the significant computational cost required to
determine the Bayes optimal hypothesis in the general case.
• BAYES THEOREM In machine learning, interested in determining the best hypothesis
from some space H, given the observed training data D.
• One way to specify what we mean by the best hypothesis is to say that we demand
the most probable hypothesis, given the data D plus any initial knowledge about the
prior probabilities of the various hypotheses in H.
• Bayes theorem provides a direct method for calculating such probabilities
• P(h) to denote the initial probability that hypothesis h holds, before we have
observed the training data.
• P(h) is often called the prior probability of h and may reflect any background
knowledge we have about the chance that h is a correct hypothesis.
• If we have no such prior knowledge, then we might simply assign the same
prior probability to each candidate hypothesis.
• Similarly, we will write P(D) to denote the prior probability that training data
D will be observed.
• P(D/ h) to denote the probability of observing data D given some world in
which hypothesis h holds.
• P(x / y) to denote the probability of x given y. In machine learning problems
interested in P (h / D) that h holds given the observed training data D.
• P (h / D) is called the posterior probability of h, because it reflects our
confidence that h holds after we have seen the training data D. Notice the
posterior probability P(h/D) reflects the influence of the training data D, in
contrast to the prior probability P(h) , which is independent of D.
• Bayes theorem is the cornerstone of Bayesian learning methods
because it provides a way to calculate the posterior probability
P(h/D), from the prior probability P(h), together with P(D) and
P(D(h)).
• Second probability estimate is zero, this probability term will dominate the Bayes classifier if the
future query contains Wind = strong. The reason is that the quantity calculated in Equation (6.20)
requires multiplying all the other probability terms by this zero value
MAXIMUM LIKELIHOOD AND LEAST-SQUARED ERROR
HYPOTHESES
• Consider the problem of learning a
continuous-valued target function-a problem
faced by many learning approaches such as
neural network learning, linear regression,
and polynomial curve fitting.
• A straightforward Bayesian analysis will show
that under certain assumptions any learning
algorithm that minimizes the squared error
between the output hypothesis predictions
and the training data will output a maximum
likelihood hypothesis.
• The significance of this result is that it
provides a Bayesian justification for many
neural network and other curve fitting
methods that attempt to minimize the sum of
squared errors over the training data.
A simple example of such a problem is learning a linear function, though our analysis applies to learning
arbitrary real-valued functions. Figure 6.2 illustrates a linear target function f depicted by the solid line,
and a set of noisy training examples of this target function. The dashed line corresponds to the
hypothesis hML with least-squared training error, hence the maximum likelihood hypothesis. Notice that
the maximum likelihood hypothesis is not necessarily identical to the correct hypothesis, f, because it is
inferred from only a limited sample of noisy training data.
• We can convert between the two easily, because if the saturation points
are (±1), then we can convert to (0, 1) by using 0.5 × (x + 1).
• Got a new form of error computation and a new activation function that
decides whether or not a neuron should fire
• Compute the gradient of these errors and use them to decide how much
to update each weight in the network.
• We will do that first for the nodes connected to the output layer, and
after we have updated those, we will work backwards through the
network until we get back to the inputs again.
• There are just two problems:
• for the output neurons, we don’t know the inputs.
• for the hidden neurons, we don’t know the targets; for extra hidden
layers, we know neither the inputs nor the targets, but even this won’t
matter for the algorithm we derive.
• The chain rule of differentiation tells us that if we want to know how the
error changes as we vary the weights, we can think about how the error
changes as we vary the inputs to the weights, and multiply this by how
those input values change as we vary the weights.
• This is useful because it lets us calculate all of the derivatives that we
want to:
• we can write the activations of the output nodes in terms of the
activations of the hidden nodes and the output weights, and then we can
send the error calculations back through the network to the hidden layer
to decide what the target outputs were for those neurons.
• Do exactly the same computations if the network has extra hidden layers
between the inputs and the outputs.
• It gets harder to keep track of which functions we should be
differentiating, but there are no new tricks needed.
• Compute the gradients of the errors with respect to the weights, so that
we change the weights so that we go downhill, which makes the errors
get smaller.
• We do this by differentiating the error function with respect to the
weights, but we can’t do this directly, so we have to apply the chain rule
and differentiate with respect to things that we know.
• This leads to two different update functions, one for each of the sets of
weights, and we just apply these backwards through the network,
starting at the outputs and ending up back at the inputs.
• Quick summary of how the algorithm works, and then the full MLP
training algorithm using back-propagation of error is described.
• 1. an input vector is put into the input nodes
• 2. the inputs are fed forward through the network (Figure 4.6)
• the inputs and the first-layer weights (here labelled as v) are used to
decide whether the hidden nodes fire or not. The activation function g(·)
is the sigmoid function given in Equation (4.2) above
• the outputs of these neurons and the second-layer weights (labelled as
w) are used to decide if the output neurons fire or not
• 3. The error is computed as the sum-of-squares difference between the
network outputs and the targets
• 4. this error is fed backwards through the network in order to
• first update the second-layer weights
• and then afterwards, the first-layer weights