Learn about probability which are the basics of artificial intelligence and deep learning.
Probability
Two Perspectives of Machine Learning
Machine learning can be explained in two ways,
 Machine learning is to find a ‘function’ which describes data the best (by deciding the function parameter).
 Machine learning is to find a ‘probability density’ which describes data the best (by deciding the probability density function parameter).
 e.g. If data was described on gaussian distribution, we have to find the best mean and covariance for the data.
Random Variable
 A random variable is a variable that can take on different values randomly and a description of the states that are possible.
 It must be coupled with a probability distribution that specifies how likely each of these states are.
 Random variables can be discrete or continuous.
Probability Distributions
 Probability distribution is a description of how likely a set of random variables is to take on each of its possible states.
Discrete Variables and PMF
 Probability mass function (PMF) is a probability distribution function over discrete variables.
 PMF maps from a state of a random variable to the probability of that random variable taking on that state.
 Notation: or
 PMF can act on many variables at the same time which is known as a joint probability distribution.
 denotes the probability that and simultaneously.
 PMF must satisfy the following properties:
 The domain of must be the set of all possible states of .
 .
 (property as being normalized)
Continuous Variables and PDF
 Probability density function (PDF) is a probability distribution function over continuous variables.
 PDF must satisfy the following properties:
 The domain of must be the set of all possible states of .
 .
 .
 In the univariate example, The probability that lies in the interval is given by .
 Uniform distribution on :
Marginal Probability
 Marginal probability distribution is a probability distribution over a subset of probability distribution over a set of variables (joint probability distribution).
 For discrete random variables , and we know , we can find with the sum rule:
 For continuous variables, we need to use integration instead of summation:
Conditional Probability
 Conditional probability is a probability of some event, given that some other event has happened.
 The conditional probability that given as when
Chain Rule of Conditional Probabilities
 Chain rule (product rule): Any joint probability distribution over many random variables may be decomposed into conditional distributions over only one variable:
Independence and Conditional Independence
 Two random variables and are independent () if their probability distribution can be expressed as a product of two factors, one involving only and one involving only :
 Two random variables and are conditionally independent () given a random variable if the conditional probability distribution over and factorizes in this way for every value of :
Expectation, Variance and Covariance
Expectation
 Expectation and expected value of some function with respect to a probability distribution is the average or mean value that takes on when is drawn from .
 For discrete variables:
 For continuous variables:
 Expectations are linear (when and are not dependent on ):
Variance
 Variance gives a measure of how much the values of a function of a random variable vary as we sample different values of from its probability distribution
 When the variance is low, the values of cluster near their expected value.
 The square root of the variance is known as the standard deviation.
Covariance
 Covariance gives some sense of how much two values are linearly related to each other, as well as the scale of these variables:
 High absolute values of the covariance mean that the values change very much and are both far from their respective means at the same time.
 : increases when increases
 : decreases when increases
 : there is no linear relation between and , they are independent, but not always.
 Covariance matrix of a random vector is an matrix, such that
 The diagonal elements of the covariance give the variance:
Correlation
 Correlation normalize the contribution of each variable in order to measure only how much the variables are related, rather than also being affected by the scale of the separate variables.
Common Probability Distribution
Bernoulli Distribution
 Bernoulli distribution is a distribution over a single binary random variable.
 It is controlled by a single parameter , which gives the probability of the random variable being equal to 1.
 It has the following properties:
Multinoulli Distribution
 Multinoulli or categorical distribution is a distribution over a single discrete variable with different states, where is finite.
 It is parameterized by a vector , where gives the probability of the th state.
 th state’s propability is given by
 It is often used to refer to distributions over categories of objects.
Gaussian Distribution
 Gaussian or normal distribution is the most commonly used distribution over real numbers.
 The mean , the standard deviation and the variance by .
 When we need to frequently evaluate the PDF, a more efficient way of parametrizing the distribution is to use a parameter to control the precision or inverse variance of the distribution:
 The normal distribution generalizes to , in which case it is known as the multivariate normal distribution.
 It is parameterized with a positive definite symmetric matrix .
Exponential and Laplace Distributions
 Exponential distribution is often used when we want to have a probability distribution with a sharp point at .
 It uses the indicator function to assign probability zero to all negative values of .
 A closely related probability distribution that allows us to place a sharp peak of probability mass at an arbitrary point is the Laplace distribution.
Mixtures of Distributions
 Mixtures of Distribution is a distributions made up of several component distributions.
 The choice of which component distribution generates the sample is determined by sampling a component identity from a multinoulli distribution
 is the multinoulli distribution over component identities.
Bayes’ Rule
 When we know and need to know , if we also know we can compute it using Bayes’ rule.
 : posterior which is a probability of the state (event) given the data (event)
 It is a conditional probability that the likelihood of event occurring given that is true.
 : likelihood which is an observation
 It is a conditional probability that the likelihood of event occurring given that is true.
 : prior of which is an preliminary information about the state
 It is a marginal probability that the probability of observing .
 : prior or evidence of which is usually feasible to compute or .
 It is a marginal probability that the probability of observing .
 : posterior which is a probability of the state (event) given the data (event)
 Bayes’ Rule where and are events and :
Information Theory
Information theory is a branch of applied mathematics that revovles around quantifying how much information is present in a signal.
 In the context of machine learning, a few key ideas from information theory to characterize probability distributions or quantify similarity between probability distributions.
 The basic intuition is that learning that an unlikely event has occurred is more informative than learning that a likely event has occurred.
 Likely events should have low information content, and in the extreme case, events that are guaranteed to happen should have no information content whatsoever.
 Less likely events should have higher information content.
 Independent events should have additive information.
Selfinformation
 Selfinformation of an event :
 Using natural logarithm with base
 is written in units of nats.
 Selfinformation deals only with a single outcome.
Shannon entropy
 Shannon entropy: Quantify the amount of uncertainty in an entire probability distribution:
 Shannon entropy of a distribution is the expected amount of information in an event drawn from that distribution.
 Distributions that are nearly deterministic have low entropy, distribution that are closer to uniform have high entropy as shown in the figure.
 When x is continuous, the Shannon entropy is known as the differential entropy.
KullbackLeibler (KL) divergence
 If we have two separate probability distributions and over the same random variable , we can measure how different these two distributions are using the KL divergence:
 KL divergence useful properties
 It is nonnegative
 KL divergence is 0 if and only if and are the same distribution in the case of discrete variables, or equal “almost everywhere” in the case of continuous variables.
 It is often conceptualized as measuring some sort of distance between two distributions.
 However, it is not a true distance measure because it is not symmetric: .
Crossentropy
 A quantity that is closely related to the KL divergence is the crossentropy.
 Minimizing the crossentropy with respect to is equivalent to minimizing the KL divergence, because does not participate in the omitted term.
 is treated as
Maximum Likelihood Estimation (MLE)
 Maximum Likelihood Estimation (MLE) is a way of parameter estimation or random variable with given observation or data.
 e.g. Imagine if we want to predict by throwing a coin with the probability of of front and of back. To compute with MLE, we can just divide the number of fronts by the total number of times.
 Consider a set of examples drawn independently from the true but unknown data generating distribution .
 Let be a parametric family of probability distributions over the same space indexed by
 The likelihood can be defined as,
 MLE which is to maximize the likelihood can be defined as,

“In what value of unknown parameter , does the observed data get the highest probability?”

This product over many probabilities can cause inconvenience such as numerical underflow.
 So, take the logarithm of the likelihood and transform a product into a sum
 MLE has a drawback that it is too sensitive to given observation or data.
 e.g. If we throw a coin number of time and got number of front, MLE can consider it is a coin with only front.
MLE Usage
 Neural Network
 In training NN, we usually minimize the negative loglikelihood (crossentropy) which is equivalent to MLE.
 The only constraint to use the negative loglikelihood is to have an output lyaer that can be interpreted as a probability distribution, which we usually we softmax.
 MLE applied to deep networks is called Backpropagation.
 To choose the optimal values of , we use gradient descent where we continually update in a way that leads to a step up with respect to likelihood.
 Regularization terms can be added and sometimes can be interpreted as prior distributions over the parameters, in that case we are looking for the maximum a posteriori (MAP).
 In training NN, we usually minimize the negative loglikelihood (crossentropy) which is equivalent to MLE.
Figure: MLE training for neural networks.
 Linear, logistic regression and multiclass logistic regression
 Conditional random field (CRF)
 Hidden Markov Model (HMM)
Maximum a Posteriori Estimation (MAP)
 Maximum a posteriori estimation (MAP) estimate parameter which has the maximum probability given data, instead of maximizing the probability of data given parameter (MLE).
 MAP estimate chooses the point of maximal posterior probability or maximal probability density in the more common case of continuous .
 As we can only observe (likelihood), we use Bayes’ Theroem to use .
 MAP Bayesian inference has the advantage of leveraging information that is brought by the prior and connot be found in the training data.
 This additional information helps to reduce the variance in the MAP point estimate compared to the MLE.
 MLE vs. MAP
 Assume we train a logistic regression model,
 MLE training: pick to maximize
 MLE training: pick to maximize
 If a prior information is given as part of the problem, then use MAP.
 If not, we cannot use MAP and MLE is a reasonable approach.
 Assume we train a logistic regression model,
MAP Usage
 Neural Network
 MAP is closely related to the method of MLE, but employs an augmented optimization objective which incorporates a prior distribution over the quantity one want to estimate.
 MAP estimation can therefore be seen as a regularization of MLE.
Figure: MAP training for neural networks.
 Bayesian Neural Network
 Hidden Markov Model (HMM)