




























































































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!





























































































ii
©2013 soulmachine Except where otherwise noted, This document is licensed under a Creative Commons Attribution-ShareAlike 3. Unported (CC BY-SA3.0) license (http://creativecommons.org/licenses/by/3.0/).
Contents.................................... v
Preface vii
10.5.1 d-separation and the Bayes
List of Contributors
Wei Zhang PhD candidate at the Institute of Software, Chinese Academy of Sciences (ISCAS), Beijing, P.R.CHINA, e-mail: [email protected], has written chapters of Naive Bayes and SVM.
Fei Pan Master at Beijing University of Technology, Beijing, P.R.CHINA, e-mail: [email protected], has written chapters of KMeans, AdaBoost.
Yong Li PhD candidate at the Institute of Automation of the Chinese Academy of Sciences (CASIA), Beijing, P.R.CHINA, e-mail: [email protected], has written chapters of Logistic Regression.
Jiankou Li PhD candidate at the Institute of Software, Chinese Academy of Sciences (ISCAS), Beijing, P.R.CHINA, e-mail: [email protected], has written chapters of BayesNet.
xi
Notation
It is very difficult to come up with a single, consistent notation to cover the wide variety of data, models and algorithms that we discuss. Furthermore, conventions difer between machine learning and statistics, and between different books and papers. Nevertheless, we have tried to be as consistent as possible. Below we summarize most of the notation used in this book, although individual sections may introduce new notation. Note also that the same symbol may have different meanings depending on the context, although we try to avoid this where possible.
Symbol Meaning
⌊x⌋ Floor of x, i.e., round down to nearest integer ⌈x⌉ Ceiling of x, i.e., round up to nearest integer x y Convolution of x and y x ⊙ y Hadamard (elementwise) product of x and y a ^ b logical AND a _ b logical OR :a logical NOT I(x) Indicator function, I(x) = 1 if x is true, else I(x) = 0 ¥ Infinity ! Tends towards, e.g., n! ¥ μ Proportional to, so y = ax can be written as y μ x jxj Absolute value jSj Size (cardinality) of a set n! Factorial function Ñ Vector of first derivatives Ñ^2 Hessian matrix of second derivatives ≜ Defined as O() Big-O: roughly means order of magnitude R The real numbers 1 : n Range (Matlab convention): 1 : n = 1 ; 2 ; :::; n Approximately equal to arg max x f (x) Argmax: the value x that maximizes f
B(a; b) Beta function, B(a; b) =
G (a) G (b) G (a + b)
B( ) Multivariate beta function,
k
G ( ak)
G (å k
ak) (n k
n choose k , equal to n!=(k!(nk)!) d (x) Dirac delta function, d (x) = ¥ if x = 0, else d (x) = 0 exp(x) Exponential function ex G (x) Gamma function, G (x) =
∫ (^) ¥ 0 u x (^1) e udu
Y (x) Digamma function,Psi(x) =
d dx log G (x)
xiii
xiv Notation
X A set from which values are drawn (e.g.,X = RD)
We use boldface lower-case to denote vectors, such as x, and boldface upper-case to denote matrices, such as X. We denote entries in a matrix by non-bold upper case letters, such as Xi j. Vectors are assumed to be column vectors, unless noted otherwise. We use (x 1 ; ; xD) to denote a column vector created by stacking D scalars. If we write X = (x 1 ; ; xn), where the left hand side is a matrix, we mean to stack the xi along the columns, creating a matrix.
Symbol Meaning X ≻ 0 X is a positive definite matrix tr(X) Trace of a matrix det(X) Determinant of matrix X jXj Determinant of matrix X X ^1 Inverse of a matrix X†^ Pseudo-inverse of a matrix XT^ Transpose of a matrix xT^ Transpose of a vector diag(x) Diagonal matrix made from vector x diag(X) Diagonal vector extracted from matrix X I or Id Identity matrix of size d d (ones on diagonal, zeros of) 1 or (^1) d Vector of ones (of length d) 0 or (^0) d Vector of zeros (of length d)
jjxjj = jjxjj 2 Euclidean or ℓ 2 norm
d å j= 1
x^2 j
jjxjj 1 ℓ 1 norm
d å j= 1
x (^) j
X:; j j’th column of matrix Xi;: transpose of i’th row of matrix (a column vector) Xi; j Element (i; j) of matrix X x y Tensor product of x and y
We denote random and fixed scalars by lower case, random and fixed vectors by bold lower case, and random and fixed matrices by bold upper case. Occasionally we use non-bold upper case to denote scalar random variables. Also, we use p() for both discrete and continuous random variables
Symbol Meaning X;Y Random variable P() Probability of a random event F() Cumulative distribution function(CDF), also called distribution function p(x) Probability mass function(PMF) f (x) probability density function(PDF) F(x; y) Joint CDF p(x; y) Joint PMF f (x; y) Joint PDF
xvi Notation
K Number of states or dimensions of a variable (often latent) k(x; y) Kernel function K Kernel matrix H Hypothesis space L Loss function J() Cost function f (x) Decision function P(yjx) TODO l Strength of ℓ 2 or ℓ 1 regularizer ϕ (x) Basis function expansion of feature vector x F Basis function expansion of design matrix X q() Approximate or proposal distribution Q(; old ) Auxiliary function in EM T Length of a sequence T (D) Test statistic for data T Transition matrix of Markov chain Parameter vector (s)^ s’th sample of parameter vector ˆ Estimate (usually MLE or MAP) of ^ ˆMLE Maximum likelihood estimate of ^ ˆMAP MAP estimate of ^ ¯ Estimate (usually posterior mean) of w Vector of regression weights (called in statistics) b intercept (called e in statistics) W Matrix of regression weights xi j Component (i.e., feature) j of data case i ,for i = 1 : N; j = 1 : D xi Training case, i = 1 : N X Design matrix of size N D x ¯ Empirical mean ¯x =
åNi= 1 xi x ˜ Future test case x Feature test case y Vector of all training labels y = (y 1 ; :::; yN ) zi j Latent component j for case i
Chapter 1
Introduction
Supervised learning
Classification Regression
Unsupervised learning
Discovering clusters Discovering latent factors Discovering graph structure Matrix completion
Model = Representation + Evaluation + Optimization^1
In supervised learning, a model must be represented as a conditional probability distribution P(yjx)(usually we call it classifier) or a decision function f (x). The set of classifiers(or decision functions) is called the hypothesis space of the model. Choosing a representation for a model is tantamount to choosing the hypothesis space that it can possibly learn.
In the hypothesis space, an evaluation function (also called objective function or risk function) is needed to distinguish good classifiers(or decision functions) from bad ones.
1.2.2.1 Loss function and risk function
Definition 1.1. In order to measure how well a function fits the training data, a loss function L : Y Y! R 0 is
(^1) Domingos, P. A few useful things to know about machine learning. Commun. ACM. 55(10):7887 (2012).
defined. For training example (xi; yi), the loss of predict- ing the value by is L(yi; by).
The following is some common loss functions:
1 ; Y = f (X) 0 ; Y ̸= f (X)
Definition 1.2. The risk of function f is defined as the ex- pected loss of f :
Rexp( f ) = E [L (Y; f (X))] =
∫ L (y; f (x)) P(x; y)dxdy (1.1) which is also called expected loss or risk function.
Definition 1.3. The risk function Rexp( f ) can be esti- mated from the training data as
Remp( f ) =
N å i= 1
L (yi; f (xi)) (1.2)
which is also called empirical loss or empirical risk.
You can define your own loss function, but if you’re a novice, you’re probably better off using one from the literature. There are conditions that loss functions should meet^2 :
1
Chapter 2
Probability
what is probability? One is called the frequentist interpretation. In this view, probabilities represent long run frequencies of events. For example, the above statement means that, if we flip the coin many times, we expect it to land heads about half the time. The other interpretation is called the Bayesian inter- pretation of probability. In this view, probability is used to quantify our uncertainty about something; hence it is fundamentally related to information rather than repeated trials (Jaynes 2003). In the Bayesian view, the above state- ment means we believe the coin is equally likely to land heads or tails on the next toss One big advantage of the Bayesian interpretation is that it can be used to model our uncertainty about events that do not have long term frequencies. For example, we might want to compute the probability that the polar ice cap will melt by 2020 CE. This event will happen zero or one times, but cannot happen repeatedly. Nevertheless, we ought to be able to quantify our uncertainty about this event. To give another machine learning oriented exam- ple, we might have observed a blip on our radar screen, and want to compute the probability distribution over the location of the corresponding target (be it a bird, plane, or missile). In all these cases, the idea of repeated trials does not make sense, but the Bayesian interpretation is valid and indeed quite natural. We shall therefore adopt the Bayesian interpretation in this book. Fortunately, the basic rules of probability theory are the same, no matter which interpretation is adopted.
We denote a random event by defining a random variable X. Descrete random variable: X can take on any value from a finite or countably infinite set. Continuous random variable: the value of X is real- valued.
F(x) ≜ P(X x) =
åux p(u)^ , discrete ∫ (^) x ¥ f^ (u)du^ , continuous^
2.2.1.2 PMF and PDF
For descrete random variable, We denote the probability of the event that X = x by P(X = x), or just p(x) for short. Here p(x) is called a probability mass function or PMF.A probability mass function is a function that gives the probability that a discrete random variable is ex- actly equal to some value^4. This satisfies the properties 0 p(x) 1 and (^) åx 2 X p(x) = 1. For continuous variable, in the equation F(x) =
∫ (^) x ¥ f^ (u)du,^ the^ function^ f^ (x)^ is^ called^ a probability density function or PDF. A probability density function is a function that describes the rela- tive likelihood for this random variable to take on a given value∫ 5 .This satisfies the properties f (x) 0 and ¥ ¥ f^ (x)dx^ =^ 1.
2.2.2.1 Joint CDF
We denote joint CDF by F(x; y) ≜ P(X x \ Y y) = P(X x;Y y).
F(x; y) ≜ P(X x;Y y) =
åux;vy p(u;^ v) ∫ (^) x ¥
∫ (^) y ¥ f^ (u;^ v)dudv (2.2) product rule:
p(X;Y ) = P(XjY )P(Y ) (2.3)
Chain rule:
(^4) http://en.wikipedia.org/wiki/Probability_ mass_function (^5) http://en.wikipedia.org/wiki/Probability_ density_function
3
4
p(X1:N ) = p(X 1 )p(X 3 jX 2 ; X 1 ):::p(XN jX1:N 1 ) (2.4)
2.2.2.2 Marginal distribution
Marginal CDF:
FX (x) ≜ F(x; +¥) = 8 < :
å xix
P(X = xi) = å xix
+¥ å j= 1
P(X = xi;Y = y (^) j) ∫ (^) x ¥ fX^ (u)du^ =^
∫ (^) x ¥
∫ (^) +¥ ¥ f^ (u;^ v)dudv
FY (y) ≜ F(+¥; y) = 8
<
:
å y (^) j y
p(Y = y (^) j) =
+¥ å i= 1
åy (^) j y P(X^ =^ xi;Y^ =^ y^ j) ∫ (^) y ¥ fY^ (v)dv^ =^
∫ (^) +¥ ¥
∫ (^) y ¥ f^ (u;^ v)dudv
Marginal PMF and PDF: { P(X = xi) = å+ j=¥ 1 P(X = xi;Y = y (^) j) , descrete fX (x) =
∫ (^) +¥ ¥ f^ (x;^ y)dy^ , continuous (2.7)
{ p(Y = y (^) j) = (^) å+ i=¥ 1 P(X = xi;Y = y (^) j) , descrete fY (y) =
∫ (^) +¥ ¥ f^ (x;^ y)dx^ , continuous (2.8)
2.2.2.3 Conditional distribution
Conditional PMF:
p(X = xijY = y (^) j) =
p(X = xi;Y = y (^) j) p(Y = y (^) j)
if p(Y ) > 0 (2.9)
The pmf p(XjY ) is called conditional probability. Conditional PDF:
fXjY (xjy) = f (x; y) fY (y)
p(Y = yjX = x) = p(X = x;Y = y) p(X = x)
=
p(X = xjY = y)p(Y = y) åy′ p(X = xjY = y′)p(Y = y′) (2.11)
We say X and Y are unconditionally independent or marginally independent, denoted X? Y , if we can represent the joint as the product of the two marginals, i.e., X? Y = P(X;Y ) = P(X)P(Y ) (2.12) We say X and Y are conditionally independent(CI) given Z if the conditional joint can be written as a product of conditional marginals:
X? Y jZ = P(X;Y jZ) = P(XjZ)P(Y jZ) (2.13)
Since the cdf F is a monotonically increasing function, it has an inverse; let us denote this by F ^1. If F is the cdf of X , then F ^1 ( a) is the value of x a such that P(X x a ) = a; this is called the a quantile of F. The value F ^1 ( 0 : 5 ) is the median of the distribution, with half of the probability mass on the left, and half on the right. The values F ^1 ( 0 : 25 ) and F^1 ( 0 : 75 )are the lower and up- per quartiles.
The most familiar property of a distribution is its mean,or expected value, denoted by m. For discrete rvs, it is de- fined as E[X] ≜ åx 2 X xp(x), and for continuous rvs, it is defined as E[X] ≜
∫ X xp(x)dx. If this integral is not finite, the mean is not defined (we will see some examples of this later). The variance is a measure of the spread of a distribu- tion, denoted by s 2. This is defined as follows:
var[X] = E[(X m)^2 ] (2.14)
=
∫ (x m)^2 p(x)dx
=
∫ x^2 p(x)dx + m^2
∫ p(x)dx 2 m
∫ xp(x)dx
= E[X^2 ] m^2 (2.15)
from which we derive the useful result
E[X^2 ] = s 2 + m^2 (2.16)
The standard deviation is defined as