


























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



























































COMPILED BY ABHISHEK PRASAD
Probability–the Science of Uncertainty
and Data by Fabi´an Kozynski
Definition (Sample space) A sample space Ω is the set of all
possible outcomes. The set’s elements must be mutually exclusive, collectively exhaustive and at the right granularity.
Definition (Event) An event is a subset of the sample space.
Probability is assigned to events.
Definition (Probability axioms) A probability law P assigns probabilities to events and satisfies the following axioms:
Nonnegativity P(A) ≥ 0 for all events A.
Normalization P(Ω) = 1.
(Countable) additivity For every sequence of events A 1 , A 2 ,...
such that Ai ∩ Aj = ∅: P ⋃ i
Ai = (^) ∑ i
P(Ai).
Corollaries (Consequences of the axioms)
P
n ⋃ i= 1
Ai =
n ∑ i= 1
P(Ai).
Example (Discrete uniform law) Assume Ω is finite and consists of n equally likely elements. Also, assume that A ⊂ Ω with k
elements. Then P(A) = k n.
Definition (Conditional probability) Given that event B has
occurred and that P (B) > 0, the probability that A occurs is
Remark (Conditional probabilities properties) They are the same as ordinary probabilities. Assuming P(B) > 0:
Proposition (Multiplication rule)
P(A 1 ∩A 2 ∩⋯∩An) = P(A 1 )⋅P(A 2 SA 1 )⋯P(AnSA 1 ∩A 2 ∩⋯∩An− 1 ).
Theorem (Total probability theorem) Given a partition {A 1 , A 2 ,.. .} of the sample space, meaning that (^) ⋃ i
Ai = Ω and the
events are disjoint, and for every event B, we have
P(B) = (^) Q i
P(Ai)P(BSAi).
Theorem (Bayes’ rule) Given a partition {A 1 , A 2 ,.. .} of the sample space, meaning that (^) ⋃ i
Ai = Ω and the events are disjoint,
and if P(Ai) > 0 for all i, then for every event B, the conditional probabilities P(AiSB) can be obtained from the conditional probabilities P(BSAi) and the initial probabilities P(Ai) as follows:
P(AiSB) =
P(Ai)P(BSAi) ∑j P(Aj )P(BSAj )^
Definition (Independence of events) Two events are independent if occurrence of one provides no information about the other. We say that A and B are independent if
P(A ∩ B) = P(A)P(B).
Equivalently, as long as P(A) > 0 and P(B) > 0,
P(BSA) = P(B) P(ASB) = P(A).
Remarks
P(A ∩ BSC) = P(ASC)P(BSC).
Definition (Independence of a collection of events) We say that events A 1 , A 2 ,... , An are independent if for every collection of distinct indices i 1 , i 2 ,... , ik , we have
P(Ai 1 ∩... ∩ Aik ) = P(Ai 1 ) ⋅ P(Ai 2 )⋯P(Aik ).
This section deals with finite sets with uniform probability law. In this case, to calculate P(A), we need to count the number of elements in A and in Ω. Remark (Basic counting principle) For a selection that can be done in r stages, with ni choices at each stage i, the number of possible selections is n 1 ⋅ n 2 ⋯nr. Definition (Permutations) The number of permutations (orderings) of n different elements is
n! = 1 ⋅ 2 ⋅ 3 ⋯n.
Definition (Combinations) Given a set of n elements, the number of subsets with exactly k elements is
n k
n! k!(n − k)!
Definition (Partitions) We are given an n−element set and nonnegative integers n 1 , n 2 ,... , nr , whose sum is equal to n. The number of partitions of the set into r disjoint subsets, with the ith subset containing exactly ni elements, is equal to
n n 1 ,... , nr
n! n 1 !n 2 !⋯nr!
Remark This is the same as counting how to assign n distinct elements to r people, giving each person i exactly ni elements.
Definition (Random variable) A random variable X is a function of the sample space Ω into the real numbers (or Rn). Its range can be discrete or continuous. Definition (Probability mass funtion (PMF)) The probability law of a discrete random variable X is called its PMF. It is defined as
pX (x) = P(X = x) = P ({ω ∈ Ω ∶ X(ω) = x}).
Properties
pX (x) ≥ 0 , ∀ x.
∑x pX (x) = 1. Example (Bernoulli random variable) A Bernoulli random variable X with parameter 0 ≤ p ≤ 1 (X ∼ Ber(p)) takes the following values:
X =
1 w.p. p, 0 w.p. 1 − p.
An indicator random variable of an event (IA = 1 if A occurs) is an example of a Bernoulli random variable. Example (Discrete uniform random variable) A Discrete uniform random variable X between a and b with a ≤ b (X ∼ Uni[a, b]) takes any of the values in {a, a + 1 ,... , b} with probability (^) b−^1 a+ 1. Example (Binomial random variable) A Binomial random variable X with parameters n (natural number) and 0 ≤ p ≤ 1 (X ∼ Bin(n, p)) takes values in the set { 0 , 1 ,... , n} with probabilities pX (i) = n i pi( 1 − p)n−i. It represents the number of successes in n independent trials where each trial has a probability of success p. Therefore, it can also be seen as the sum of n independent Bernoulli random variables, each with parameter p. Example (Geometric random variable) A Geometric random variable X with parameter 0 ≤ p ≤ 1 (X ∼ Geo(p)) takes values in the set { 1 , 2 ,.. .} with probabilities pX (i) = ( 1 − p)i−^1 p. It represents the number of independent trials until (and including) the first success, when the probability of success in each trial is p. Definition (Expectation/mean of a random variable) The expectation of a discrete random variable is defined as
△ = (^) Q x
xpX (x).
assuming (^) ∑x SxSpX (x) < ∞. Properties (Properties of expectation)
Example Expected value of know r.v.
Example (Exponential random variable) An Exponential random variable X with parameter λ > 0 (X ∼ Exp(λ)) has PDF
fX (x) =
λe−λx, if x ≥ 0 , 0 , otherwise.
We have E[X] = 1 λ and Var(X)^ =^
1 λ^2.
Definition (Cumulative Distribution Function (CDF)) The CDF of a random variable X is FX (x) = P(X ≤ x).
In particular, for a continuous random variable, we have
FX (x) =
x
S −∞
fX (x)dx,
fX (x) =
dFX (x) dx
Properties (Properties of CDF)
FX (x) = 0.
FX (x) = 1.
Definition (Normal/Gaussian random variable) A Normal random
variable X with mean μ and variance σ^2 > 0 (X ∼ N (μ, σ^2 )) has PDF
fX (x) =
2 πσ^2
e − 1 2 σ^2 (x−μ)^2 .
We have E[X] = μ and Var(X) = σ^2.
Remark (Standard Normal) The standard Normal is N ( 0 , 1 ).
Proposition (Linearity of Gaussians) Given X ∼ N (μ, σ^2 ), and if a ≠ 0, then aX + b ∼ N (aμ + b, a^2 σ^2 ).
Using this Y = X−μ σ is a standard gaussian.
Definition (Conditional PDF given an event) Given a continuous random variable X and event A with P (A) > 0, we define the
conditional PDF as the function that satisfies
P(X ∈ BSA) = (^) S B
fXSA(x)dx.
Definition (Conditional PDF given X ∈ A) Given a continuous random variable X and an A ⊂ R, with P (A) > 0:
fXSX∈A(x) =
1 P(A) fX^ (x),^ x^ ∈^ A, 0 , x ~∈ A.
Definition (Conditional expectation) Given a continuous random
variable X and an event A, with P (A) > 0:
∞
−∞
fXSA(x)dx.
Definition (Memorylessness of the exponential random variable)
When we condition an exponential random variable X on the event X > t we have memorylessness, meaning that the “remaining time”
X − t given that X > t is also geometric with the same parameter i.e.,
P(X − t > xSX > t) = P(X > x).
Theorem (Total probability and expectation theorems) Given a partition of the space into disjoint events A 1 , A 2 ,... , An such that ∑i P(Ai)^ =^ 1 we have the following:
FX (x) = P(A 1 )FXSA 1 (x) + ⋯ + P(An)FXSAn (x),
fX (x) = P(A 1 )fXSA 1 (x) + ⋯ + P(An)fXSAn (x),
E[X] = P(A 1 )E[XSA 1 ] + ⋯ + P(An)E[XSAn].
Definition (Jointly continuous random variables) A pair (collection) of random variables is jointly continuous if there exists a joint PDF fX,Y that describes them, that is, for every set B ⊂ Rn
B
fX,Y (x, y)dxdy.
Properties (Properties of joint PDFs)
∞ ∫ −∞
fX,Y (x, y)dy.
x ∫ −∞
y ∫ −∞
fX,Y (u, v)dv du.
∂^2 FX,Y (x,y) ∂x ∂y. Example (Uniform joint PDF on a set S) Let S ⊂ R^2 with area s > 0, then the random variable (X, Y ) is uniform over S if it has PDF
fX,Y (x, y) =
1 s , (x, y) ∈ S, 0 , (x, y) ~∈ S.
Definition (Conditional PDF given another random variable) Given jointly continuous random variables X, Y and a value y such that fY (y) > 0, we define the conditional PDF as
fXSY (xSy)
fX,Y (x, y) fY (y)
Additionally we define P(X ∈ ASY = y) (^) ∫A fXSY (xSy)dx. Proposition (Multiplication rule) Given jointly continuous random variables X, Y , whenever possible we have
fX,Y (x, y) = fX (x)fY SX (ySx) = fY (y)fXSY (xSy).
Definition (Conditional expectation) Given jointly continuous random variables X, Y , and y such that fY (y) > 0, we define the conditional expected value as
E[XSY = y] = (^) S
∞
−∞
xfXSY (xSy)dx.
Additionally we have
E [g(X)SY = y] = (^) S
∞
−∞
g(x)fXSY (xSy)dx.
Theorem (Total probability and total expectation theorems)
fX (x) = (^) S
∞
−∞
fY (y)fXSY (xSy)dy,
∞
−∞
fY (y)E[XSY = y]dy.
Definition (Independence) Jointly continuous random variables X, Y are independent if fX,Y (x, y) = fX (x)fY (y) for all x, y.
Proposition (Expectation of product of independent r.v.) If X and Y are independent continuous random variables,
Remark If X and Y are independent, E [g(X)h(Y )] = E [g(X)] E [h(Y )].
Proposition (Variance of sum of independent random variables) If X and Y are independent continuous random variables,
Var(X + Y ) = Var(X) + Var(Y ).
Proposition (Bayes’ rule summary)
pX (x)pY SX (ySx) pY (y).
fX (x)fY SX (ySx) fY (y).
pX (x)fY SX (ySx) fY (y)
fX (x)pY SX (ySx) pY (y).
Proposition (Discrete case) Given a discrete random variable X and a function g, the r.v. Y = g(X) has PMF
pY (y) = (^) Q x∶g(x)=y
pX (x).
Remark (Linear function of discrete random variable) If g(x) = ax + b, then pY (y) = pX y−b a .
Proposition (Linear function of continuous r.v.) Given a continuous random variable X and Y = aX + b, with a ≠ 0, we have
fY (y) =
SaS
fX
y − b a
Corollary (Linear function of normal r.v.) If X ∼ N (μ, σ^2 ) and Y = aX + b, with a ≠ 0, then Y ∼ N (aμ + b, a^2 σ^2 ).
Example (General function of a continuous r.v.) If X is a continuous random variable and g is any function, to obtain the pdf of Y = g(X) we follow the two-step procedure:
Proposition (General formula for monotonic g) Let X be a continuous random variable and g a function that is monotonic wherever fX (x) > 0. The PDF of Y = g(X) is given by
fY (y) = fX (h(y)) W
dh dy
(y)W.
where h = g−^1 in the interval where g is monotonic.
Proposition (Discrete case) Let X, Y be discrete independent
random variables and Z = X + Y , then the PMF of Z is
pZ (z) = (^) Q x
pX (x)pY (z − x).
Proposition (Continuous case) Let X, Y be continuous independent random variables and Z = X + Y , then the PDF of Z is
fZ (z) = (^) S
∞
−∞
fX (x)fY (z − x)dx.
Proposition (Sum of independent normal r.v.) Let X ∼ N (μx, σ^2 x) and Y ∼ N (μy , σ^2 y ) independent. Then
Z = X + Y ∼ N (μx + μy , σ^2 x + σ^2 y ).
Definition (Covariance) We define the covariance of random variables X, Y as
Cov(X, Y )
△ = E [(X − E[X]) (Y − E[Y ])].
Properties (Properties of covariance)
Proposition (Variance of a sum of r.v.)
Var(X 1 + ⋯ + Xn) = (^) Q i
Var(Xi) + (^) Q i≠j
Cov(Xi, Xj ).
Definition (Correlation coefficient) We define the correlation
coefficient of random variables X, Y , with σX , σY > 0, as
ρ(X, Y )
Cov(X, Y ) σX σY
Properties (Properties of the correlation coefficient)
Definition (Conditional expectation as a random variable) Given random variables X, Y the conditional expectation E[XSY ] is the
random variable that takes the value E[XSY = y] whenever Y = y.
Theorem (Law of iterated expectations)
E [E[XSY ]] = E[X].
Definition (Conditional variance as a random variable) Given random variables X, Y the conditional variance Var(XSY ) is the random variable that takes the value Var(XSY = y) whenever Y = y. Theorem (Law of total variance)
Var(X) = E [Var(XSY )] + Var (E[XSY ]).
Proposition (Sum of a random number of independent r.v.) Let N be a nonnegative integer random variable. Let X, X 1 , X 2 ,... , XN be i.i.d. random variables. Let Y = ∑i Xi. Then
E[Y ] = E[N ]E[X],
Var(Y ) = E[N ] Var(X) + (E[X]) 2 Var(N ).
Theorem (Markov inequality) Given a random variable X ≥ 0 and, for every a > 0 we have
P(X ≥ a) ≤
a
Theorem (Chebyshev inequality) Given a random variable X with E[X] = μ and Var(X) = σ^2 , for every > 0 we have
P (SX − μS ≥ ) ≤
σ^2 ^2
Theorem (Weak Law of Large Number (WLLN)) Given a sequence of i.i.d. random variables {X 1 , X 2 ,.. .} with E[Xi] = μ and Var(Xi) = σ^2 , we define
Mn =
n
n Q i= 1
Xi,
for every > 0 we have
lim n→∞
P (SMn − μS ≥ ) = 0.
Definition (Convergence in probability) A sequence of random variables {Yi} converges in probability to the random variable Y if
lim n→∞ P (SYi − Y S ≥ ) = 0 ,
for every > 0. Properties (Properties of convergence in probability) If Xn → a and Yn → b in probability, then
Theorem (Central Limit Theorem (CLT)) Given a sequence of independent random variables {X 1 , X 2 ,.. .} with E[Xi] = μ and Var(Xi) = σ^2 , we define
Zn =
σ
n
n Q i= 1
(Xi − μ).
Then, for every z, we have
lim n→∞
P(Zn ≤ z) = P(Z ≤ z),
where Z ∼ N ( 0 , 1 ). Corollary (Normal approximation of a binomial) Let X ∼ Bin(n, p) with n large. Then Sn can be approximated by Z ∼ N (np, np( 1 − p)). Remark (De Moivre-Laplace 1/2 approximation) Let X ∼ Bin, then P(X = i) = P i − 12 ≤ X ≤ i + 12 and we can use the CLT to approximate the PMF of X.
Given a set of data points {x(1), ..., x( m )} associated to a set of outcomes {y(1), ..., y( m )}, we want to build a classifier that learns how to predict y from x.
r Type of prediction – The different types of predictive models are summed up in the table below:
Regression Classifier
Outcome Continuous Class
Examples Linear regression Logistic regression, SVM, Naive Bayes
r Type of model – The different models are summed up in the table below:
Discriminative model Generative model
Goal Directly estimate P (y|x) Estimate P (x|y) to deduce P (y|x)
What’s learned Decision boundary Probability distributions of the data
Illustration
Examples Regressions, SVMs GDA, Naive Bayes
r Hypothesis – The hypothesis is noted h θ and is the model that we choose. For a given input
data x( i ), the model prediction output is h θ (x( i )).
r Loss function – A loss function is a function L : (z,y) ∈ R × Y 7 −→ L(z,y) ∈ R that takes as inputs the predicted value z corresponding to the real data value y and outputs how different they are. The common loss functions are summed up in the table below:
Least squared Logistic Hinge Cross-entropy
1 2
(y − z) 2 log(1 + exp(−yz)) max(0, 1 − yz) −
y log( z ) + (1 − y ) log(1 − z )
Linear regression Logistic regression SVM Neural Network
r Cost function – The cost function J is commonly used to assess the performance of a model, and is defined with the loss function L as follows:
J(θ) =
i =
L(h θ (x( i )), y( i ))
r Gradient descent – By noting α ∈ R the learning rate, the update rule for gradient descent is expressed with the learning rate and the cost function J as follows:
θ ←− θ − α∇J(θ)
Remark: Stochastic gradient descent (SGD) is updating the parameter based on each training example, and batch gradient descent is on a batch of training examples.
r Likelihood – The likelihood of a model L(θ) given parameters θ is used to find the optimal parameters θ through maximizing the likelihood. In practice, we use the log-likelihood `(θ) = log(L(θ)) which is easier to optimize. We have:
θopt^ = arg max θ
L(θ)
r Newton’s algorithm – The Newton’s algorithm is a numerical method that finds θ such that `′(θ) = 0. Its update rule is as follows:
θ ← θ −
′(θ)′′(θ)
Remark: the multidimensional generalization, also known as the Newton-Raphson method, has the following update rule:
θ ← θ −
∇^2 θ `(θ)
∇ θ `(θ)
We assume here that y|x; θ ∼ N (μ,σ^2 ) r Normal equations – By noting X the matrix design, the value of θ that minimizes the cost function is a closed-form solution such that:
θ = (X T X) − 1 X T y
r LMS algorithm – By noting α the learning rate, the update rule of the Least Mean Squares (LMS) algorithm for a training set of m data points, which is also known as the Widrow-Hoff learning rule, is as follows:
∀j, θ j ← θ j + α
i =
y( i )^ − h θ (x( i ))
x ( i ) j
Remark: the update rule is a particular case of the gradient ascent.
r LWR – Locally Weighted Regression, also known as LWR, is a variant of linear regression that
weights each training example in its cost function by w( i )(x), which is defined with parameter τ ∈ R as:
w ( i ) (x) = exp
(x( i )^ − x)^2 2 τ 2
r Sigmoid function – The sigmoid function g, also known as the logistic function, is defined as follows:
∀z ∈ R, g(z) =
1 + e− z^
r Logistic regression – We assume here that y|x; θ ∼ Bernoulli(φ). We have the following form:
φ = p(y = 1|x; θ) =
1 + exp(−θ T^ x)
= g(θ T x)
Remark: there is no closed form solution for the case of logistic regressions.
r Softmax regression – A softmax regression, also called a multiclass logistic regression, is used to generalize logistic regression when there are more than 2 outcome classes. By convention, we set θ K = 0, which makes the Bernoulli parameter φ i of each class i equal to:
φ i =
exp(θ Ti x)
j =
exp(θ T j x)
r Exponential family – A class of distributions is said to be in the exponential family if it can be written in terms of a natural parameter, also called the canonical parameter or link function, η, a sufficient statistic T (y) and a log-partition function a(η) as follows:
p(y; η) = b(y) exp(ηT (y) − a(η))
Remark: we will often have T (y) = y_. Also,_ exp(−a(η)) can be seen as a normalization param- eter that will make sure that the probabilities sum to one.
Here are the most common exponential distributions summed up in the following table:
Distribution η T (y) a(η) b(y)
Bernoulli log
φ 1 − φ
y log(1 + exp(η)) 1
Gaussian μ y η^2 2 √^1 2 π exp
y^2 2
Poisson log(λ) y e η^
y!
Geometric log(1 − φ) y log
eη 1 − eη
r Assumptions of GLMs – Generalized Linear Models (GLM) aim at predicting a random variable y as a function fo x ∈ R n +1^ and rely on the following 3 assumptions:
(1) y|x; θ ∼ ExpFamily(η) (2) h θ (x) = E[y|x; θ] (3) η = θ T^ x
Remark: ordinary least squares and logistic regression are special cases of generalized linear models.
The goal of support vector machines is to find the line that maximizes the minimum distance to the line.
r Optimal margin classifier – The optimal margin classifier h is such that:
h(x) = sign(w T^ x − b)
where (w, b) ∈ R n^ × R is the solution of the following optimization problem:
min
||w||^2 such that y( i )(w T^ x( i )^ − b) > 1
Remark: the line is defined as w T^ x − b = 0_._
r Hinge loss – The hinge loss is used in the setting of SVMs and is defined as follows:
L(z,y) = [1 − yz]+ = max(0, 1 − yz)
r Union bound – Let A 1 , ..., A k be k events. We have:
P (A 1 ∪ ... ∪ A k ) 6 P (A 1 ) + ... + P (A k )
r Hoeffding inequality – Let Z 1 , .., Z m be m iid variables drawn from a Bernoulli distribution
Remark: this inequality is also known as the Chernoff bound.
empirical risk or empirical error, to be as follows:
m
i =
(^1) { h ( x ( i )) 6 = y ( i )}
r Probably Approximately Correct (PAC) – PAC is a framework under which numerous results on learning theory were proved, and has the following set of assumptions:
r Shattering – Given a set S = {x(1),...,x( d )}, and a set of classifiers H, we say that H shatters
S if for any set of labels {y(1), ..., y( d )}, we have:
∃h ∈ H, ∀i ∈ [[1,d]], h(x( i )) = y( i )
r Upper bound theorem – Let H be a finite hypothesis class such that |H| = k and let δ and the sample size m be fixed. Then, with probability of at least 1 − δ, we have:
min h ∈H
(h)
2 m
log
2 k δ
r VC dimension – The Vapnik-Chervonenkis (VC) dimension of a given infinite hypothesis class H, noted VC(H) is the size of the largest set that is shattered by H.
r Theorem (Vapnik) – Let H be given, with VC(H) = d and m the number of training examples. With probability at least 1 − δ, we have:
min h ∈H
(h)
d m
log
m d
m
log
δ
r Motivation – The goal of unsupervised learning is to find hidden patterns in unlabeled data
{x(1),...,x( m )}.
r Jensen’s inequality – Let f be a convex function and X a random variable. We have the following inequality:
E[f (X)] > f (E[X])
r Latent variables – Latent variables are hidden/unobserved variables that make estimation problems difficult, and are often denoted z. Here are the most common settings where there are latent variables:
Setting Latent variable z x|z Comments
Mixture of k Gaussians Multinomial(φ) N (μ j ,Σ j ) μ j ∈ R n , φ ∈ R k
Factor analysis N (0,I) N (μ + Λz,ψ) μ j ∈ R n
r Algorithm – The Expectation-Maximization (EM) algorithm gives an efficient method at estimating the parameter θ through maximum likelihood estimation by repeatedly constructing a lower-bound on the likelihood (E-step) and optimizing that lower bound (M-step) as follows:
Q i (z ( i ) ) = P (z ( i ) |x ( i ) ; θ)
θ i = argmax θ
i
z ( i )
Q i (z ( i ) ) log
P (x( i ),z( i ); θ) Q i (z( i ))
dz ( i )
We note c( i )^ the cluster of data point i and μ j the center of cluster j.
r Algorithm – After randomly initializing the cluster centroids μ 1 ,μ 2 ,...,μ k ∈ R n , the k-means algorithm repeats the following step until convergence:
c ( i ) = arg min j
||x ( i ) − μ j || 2 and μ j =
i =
(^1) { c ( i )= j }x( i )
i =
(^1) { c ( i )= j }
r Distortion function – In order to see if the algorithm converges, we look at the distortion function defined as follows:
J(c,μ) =
i =
||x( i )^ − μ c ( i ) ||^2
r Algorithm – It is a clustering algorithm with an agglomerative hierarchical approach that build nested clusters in a successive manner.
r Types – There are different sorts of hierarchical clustering algorithms that aims at optimizing different objective functions, which is summed up in the table below:
Ward linkage Average linkage Complete linkage
Minimize within cluster Minimize average distance Minimize maximum distance distance between cluster pairs of between cluster pairs
In an unsupervised learning setting, it is often hard to assess the performance of a model since we don’t have the ground truth labels as was the case in the supervised learning setting. r Silhouette coefficient – By noting a and b the mean distance between a sample and all other points in the same class, and between a sample and all other points in the next nearest cluster, the silhouette coefficient s for a single sample is defined as follows:
s =
b − a max(a,b)
Neural networks are a class of models that are built with layers. Commonly used types of neural networks include convolutional and recurrent neural networks.
r Architecture – The vocabulary around neural networks architectures is described in the figure below:
By noting i the i th^ layer of the network and j the j th^ hidden unit of the layer, we have:
z [ i ] j =^ w
[ i ] j
T x + b [ i ] j
where we note w, b, z the weight, bias and output respectively.
r Activation function – Activation functions are used at the end of a hidden unit to introduce non-linear complexities to the model. Here are the most common ones:
Sigmoid Tanh ReLU Leaky ReLU
g(z) =
1 + e− z^
g(z) =
e z^ − e− z e z^ + e− z^
g(z) = max(0,z) g(z) = max(z,z)
with 1
r Cross-entropy loss – In the context of neural networks, the cross-entropy loss L(z,y) is commonly used and is defined as follows:
L(z,y) = −
y log(z) + (1 − y) log(1 − z)
r Learning rate – The learning rate, often noted η, indicates at which pace the weights get updated. This can be fixed or adaptively changed. The current most popular method is called Adam, which is a method that adapts the learning rate.
r Backpropagation – Backpropagation is a method to update the weights in the neural network by taking into account the actual output and the desired output. The derivative with respect to weight w is computed using chain rule and is of the following form:
∂L(z,y) ∂w
∂L(z,y) ∂a
∂a ∂z
∂z ∂w
As a result, the weight is updated as follows:
w ←− w − η
∂L(z,y) ∂w
r Updating weights – In a neural network, weights are updated as follows:
r Dropout – Dropout is a technique meant at preventing overfitting the training data by dropping out units in a neural network. In practice, neurons are either dropped with probability p or kept with probability 1 − p.
r Convolutional layer requirement – By noting W the input volume size, F the size of the convolutional layer neurons, P the amount of zero padding, then the number of neurons N that fit in a given volume is such that:
r Batch normalization – It is a step of hyperparameter γ, β that normalizes the batch {x i }. By noting μ B , σ B^2 the mean and variance of that we want to correct to the batch, it is done as follows:
x i ←− γ
x i − μ B
σ^2 B +
It is usually done after a fully connected/convolutional layer and before a non-linearity layer and aims at allowing higher learning rates and reducing the strong dependence on initialization.
r Types of gates – Here are the different types of gates that we encounter in a typical recurrent neural network:
Input gate Forget gate Output gate Gate
Write to cell or not? Erase a cell or not? Reveal a cell or not? How much writing?
r LSTM – A long short-term memory (LSTM) network is a type of RNN model that avoids the vanishing gradient problem by adding ’forget’ gates.
The goal of reinforcement learning is for an agent to learn how to evolve in an environment.
r Markov decision processes – A Markov decision process (MDP) is a 5-tuple (S,A,{P sa },γ,R) where:
r Policy – A policy π is a function π : S −→ A that maps states to actions.
Remark: we say that we execute a given policy π if given a state s we take the action a = π(s).
r Value function – For a given policy π and a given state s, we define the value function V π as follows:
V π^ (s) = E
R(s 0 ) + γR(s 1 ) + γ^2 R(s 2 ) + ...|s 0 = s,π
r Bellman equation – The optimal Bellman equations characterizes the value function V π
∗
of the optimal policy π∗:
V π
∗ (s) = R(s) + max a ∈A
γ
s ′∈ S
P sa (s′)V π
∗ (s′)
Remark: we note that the optimal policy π∗^ for a given state s is such that:
π∗(s) = argmax a ∈A
s ′∈S
P sa (s′)V ∗(s′)
r Value iteration algorithm – The value iteration algorithm is in two steps:
V 0 (s) = 0
V i +1(s) = R(s) + max a ∈A
s ′∈S
γP sa (s′)V i (s′)
r Maximum likelihood estimate – The maximum likelihood estimates for the state transition probabilities are as follows:
P sa (s ′ ) =
#times took action a in state s and got to s′ #times took action a in state s
r Q-learning – Q-learning is a model-free estimation of Q, which is done as follows:
Q(s,a) ← Q(s,a) + α
R(s,a,s′) + γ max a ′^
Q(s′,a′) − Q(s,a)
r Vocabulary – When selecting a model, we distinguish 3 different parts of the data that we have as follows:
Training set Validation set Testing set
Once the model has been chosen, it is trained on the entire dataset and tested on the unseen test set. These are represented in the figure below:
r Cross-validation – Cross-validation, also noted CV, is a method that is used to select a model that does not rely too much on the initial training set. The different types are summed up in the table below:
k -fold Leave- p -out
The most commonly used method is called k-fold cross-validation and splits the training data into k folds to validate the model on one fold while training the model on the k − 1 other folds, all of this k times. The error is then averaged over the k folds and is named cross-validation error.
r Regularization – The regularization procedure aims at avoiding the model to overfit the data and thus deals with high variance issues. The following table sums up the different types of commonly used regularization techniques:
LASSO Ridge Elastic Net
... + λ||θ|| 1 ... + λ||θ||^22 ... + λ
(1 − α)||θ|| 1 + α||θ||^22
λ ∈ R λ ∈ R λ ∈ R, α ∈ [0,1]
r Model selection – Train model on training set, then evaluate on the development set, then pick best performance model on the development set, and retrain all of that model on the whole training set.
r Bias – The bias of a model is the difference between the expected prediction and the correct model that we try to predict for given data points.
r Variance – The variance of a model is the variability of the model prediction for given data points.
r Bias/variance tradeoff – The simpler the model, the higher the bias, and the more complex the model, the higher the variance.
Underfitting Just right Overfitting
Regression
Classification
Deep learning
r Error analysis – Error analysis is analyzing the root cause of the difference in performance between the current and the perfect models.
r Ablative analysis – Ablative analysis is analyzing the root cause of the difference in perfor- mance between the current and the baseline models.
r Sample space – The set of all possible outcomes of an experiment is known as the sample space of the experiment and is denoted by S.
r Event – Any subset E of the sample space is known as an event. That is, an event is a set consisting of possible outcomes of the experiment. If the outcome of the experiment is contained in E, then we say that E has occurred.
r Axioms of probability – For each event E, we denote P (E) as the probability of event E occuring. By noting E 1 ,...,E n mutually exclusive events, we have the 3 following axioms:
i =
E i
i =
P (E i )
r Permutation – A permutation is an arrangement of r objects from a pool of n objects, in a given order. The number of such arrangements is given by P (n, r), defined as:
P (n, r) =
n! (n − r)!
r Combination – A combination is an arrangement of r objects from a pool of n objects, where the order does not matter. The number of such arrangements is given by C(n, r), defined as:
C(n, r) =
P (n, r) r!
n! r!(n − r)!
Remark: we note that for 0 6 r 6 n , we have P (n,r) > C(n,r).
r Bayes’ rule – For events A and B such that P (B) > 0 , we have:
Remark: we have P (A ∩ B) = P (A)P (B|A) = P (A|B)P (B).
r Partition – Let {A i , i ∈ [[1,n]]} be such that for all i, A i 6 = ∅. We say that {A i } is a partition if we have:
∀i 6 = j, A i ∩ A j = ∅ and
i =
A i = S
Remark: for any event B in the sample space, we have P (B) =
i =
P (B|A i )P (A i ).
r Marginal density and cumulative distribution – From the joint density probability function f XY , we have:
Case Marginal density Cumulative function
(D) f X (x i ) =
j
f XY (x i ,y j ) F XY (x,y) =
xi 6 x
yj 6 y
f XY (x i ,y j )
(C) f X (x) =
−∞
f XY (x,y)dy F XY (x,y) =
ˆ (^) x
−∞
ˆ (^) y
−∞
f XY (x′,y′)dx′dy′
r Distribution of a sum of independent random variables – Let Y = X 1 + ... + X n with X 1 , ..., X n independent. We have:
ψ Y (ω) =
k =
ψ Xk (ω)
r Covariance – We define the covariance of two random variables X and Y , that we note σ^2 XY or more commonly Cov(X,Y ), as follows:
Cov(X,Y ) , σ 2 XY =^ E[(X^ −^ μ X^ )(Y^ −^ μ Y^ )] =^ E[XY^ ]^ −^ μ X^ μ Y
r Correlation – By noting σ X , σ Y the standard deviations of X and Y , we define the correlation between the random variables X and Y , noted ρ XY , as follows:
ρ XY =
σ XY^2 σ X σ Y
Remarks: For any X, Y , we have ρ XY ∈ [− 1 ,1]. If X and Y are independent, then ρ XY = 0_._
r Main distributions – Here are the main distributions to have in mind:
Type Distribution PDF ψ(ω) E[X] Var(X)
X ∼ B(n, p) P (X = x) =
n x
p x q n − x^ (pe iω^ + q) n^ np npq
Binomial x ∈ [[0,n]] (D)
X ∼ Po(μ) P (X = x) =
μ x x!
e− μ^ e μ ( e
iω (^) −1) μ μ Poisson x ∈ N
X ∼ U(a, b) f (x) =
b − a
e iωb^ − e iωa (b − a)iω
a + b 2
(b − a)^2 12 Uniform x ∈ [a,b]
(C) X ∼ N (μ, σ) f (x) =
2 πσ
e
− (^12)
x − μ σ
e iωμ −^
1 2 ω
(^2) σ 2 μ σ^2
Gaussian x ∈ R
X ∼ Exp(λ) f (x) = λe− λx^
1 − iω λ
λ
λ^2 Exponential x ∈ R+
r Random sample – A random sample is a collection of n random variables X 1 , ..., X n that are independent and identically distributed with X.
r Estimator – An estimator θˆ is a function of the data that is used to infer the value of an unknown parameter θ in a statistical model.
r Bias – The bias of an estimator θˆ is defined as being the difference between the expected value of the distribution of θˆ and the true value, i.e.:
Bias(θˆ) = E[ˆθ] − θ
Remark: an estimator is said to be unbiased when we have E[θˆ] = θ.
r Sample mean and variance – The sample mean and the sample variance of a random sample are used to estimate the true mean μ and the true variance σ^2 of a distribution, are noted X and s^2 respectively, and are such that:
n
i =
X i and s 2 = ˆσ 2 =
n − 1
i =
(X i − X) 2
r Central Limit Theorem – Let us have a random sample X 1 , ..., X n following a given distribution with mean μ and variance σ^2 , then we have:
n →+∞
μ,
σ √ n
r Vector – We note x ∈ R n^ a vector with n entries, where x i ∈ R is the i th^ entry:
x =
x^1 2 . . . x n
∈ R n
r Matrix – We note A ∈ R m × n^ a matrix with m rows and n columns, where A i,j ∈ R is the entry located in the i th^ row and j th^ column:
A 1 , 1 · · · A 1 ,n . . .
A m, 1 · · · A m,n
m × n
Remark: the vector x defined above can be viewed as a n × 1 matrix and is more particularly called a column-vector.
r Identity matrix – The identity matrix I ∈ R n × n^ is a square matrix with ones in its diagonal and zero everywhere else:
Remark: for all matrices A ∈ R n × n, we have A × I = I × A = A_._
r Diagonal matrix – A diagonal matrix D ∈ R n × n^ is a square matrix with nonzero values in its diagonal and zero everywhere else:
d 1 0 · · · 0
0
0 · · · 0 d n
Remark: we also note D as diag (d 1 ,...,d n ).
r Vector-vector multiplication – There are two types of vector-vector products:
x T^ y =
i =
x i y i ∈ R
xy T^ =
1 y 1 · · ·^ x 1 y n . . .
x m y 1 · · · x m y n
∈ R m × n
r Matrix-vector multiplication – The product of matrix A ∈ R m × n^ and vector x ∈ R n^ is a vector of size R m , such that:
Ax =
a Tr, 1 x . . . a Tr,m x
i =
a c,i x i ∈ R m
where a Tr,i are the vector rows and a c,j are the vector columns of A, and x i are the entries
of x.
r Matrix-matrix multiplication – The product of matrices A ∈ R m × n^ and B ∈ R n × p^ is a
matrix of size R n × p , such that:
a Tr, 1 b c, 1 · · · a Tr, 1 b c,p . . .
a Tr,m b c, 1 · · · a Tr,m b c,p
i =
a c,i b Tr,i ∈ R n × p
where a Tr,i , b Tr,i are the vector rows and a c,j , b c,j are the vector columns of A and B respec-
tively.
r Transpose – The transpose of a matrix A ∈ R m × n , noted A T^ , is such that its entries are flipped:
∀i,j, A T i,j =^ A j,i
Remark: for matrices A,B , we have (AB) T^ = B T^ A T^.
r Inverse – The inverse of an invertible square matrix A is noted A−^1 and is the only matrix such that:
Remark: not all square matrices are invertible. Also, for matrices A,B , we have (AB)−^1 = B−^1 A−^1
r Trace – The trace of a square matrix A, noted tr(A), is the sum of its diagonal entries:
tr(A) =
i =
A i,i
Remark: for matrices A,B , we have tr (A T^ ) = tr (A) and tr (AB) = tr (BA)
r Determinant – The determinant of a square matrix A ∈ R n × n , noted |A| or det(A) is expressed recursively in terms of A\ i, \ j , which is the matrix A without its i th^ row and j th column, as follows:
det(A) = |A| =
j =
(−1) i + j^ A i,j |A\ i, \ j |
Remark: A is invertible if and only if |A| 6 = 0_. Also,_ |AB| = |A||B| and |A T^ | = |A|.
r Symmetric decomposition – A given matrix A can be expressed in terms of its symmetric and antisymmetric parts as follows:
Symmetric
Antisymmetric
r Norm – A norm is a function N : V −→ [0, + ∞[ where V is a vector space, and such that for all x,y ∈ V , we have:
For x ∈ V , the most commonly used norms are summed up in the table below: