

























































































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!


























































































Abstract This outline summarizes the main points of lectures based on the book The Elements of Statistical Learning by Hastie, Tibshirani, and Friedman. Some of the later material here beneÖts from Izenmanís Modern Multi- variate Statistical Techniques.
1 Introduction (Ch 1 and Ch 2 of HTF) 4 1.1 Some Very Simple Probability Theory and Decision Theory and Prediction Rules........................... 5 1.2 Two Conceptually Simple Ways One Might Approximate a Con- ditional Mean............................. 6 1.2.1 Nearest Neighbor Rules................... 6 1.2.2 Rules Based on a Linear Assumption About the Form of the Conditional Mean.................... 6 1.3 The Curse of Dimensionality.................... 7 1.4 Variance-Bias Considerations in Prediction............ 8 1.5 Some Fancier Ways One Might Approximate a Conditional Mean 9 1.5.1 (Non-)Linear Regression Methods (Least Squares Fitting) 9 1.5.2 Methods Based on Local Smoothing/Averaging...... 10 1.6 Complexity, Fit, and Choice of Tuning Parameters........ 11
2 Linear Methods (Ch 3 of HTF) 11 2.1 The Gram-Schmidt Process and the QR Decomposition..... 12 2.2 The Singular Value Decomposition of a Full Rank X....... 14 2.3 Ridge Regression and the Lasso and Some Generalizations Thereof 16 2.3.1 Ridge Regression....................... 16 2.3.2 The Lasso and Generalizations............... 17 2.4 Two Methods With Derived Input Variables............ 19 Course development supported by NSF grant DMS #0502347 EMSW21-RTG awarded to the Department of Statistics, Iowa State University.
The course is (mostly) about "supervised" machine learning for statisticians. The fundamental issue here is prediction, usually with a fairly large number of predictors and a large number of cases upon which to build a predictor. For
X2 <p
an input vector (a vector of predictors) with jth coordinate Xj and
Y
some output value (usually univariate, and when itís not, weíll indicate so with some form of bold face) the object is to use N observed (X; Y ) pairs
(x 1 ; y 1 ) ; (x 2 ; y 2 ) ; : : : ; (xN ; yN )
called training data to create an e§ective prediction rule
Y^ b (X) = f (X)
"Supervised" learning means that the training data include values of the output variable. A primary di§erence between a "machine learning" point of view and that common in basic graduate statistics courses is an ambivalence toward making statements concerning parameters of any models used in the invention of pre- diction rules (including those that would describe the amount of variation in observables one can expect the model to generate). Standard statistics courses often conceive of those parameters as encoding scientiÖc knowledge about some underlying data-generating mechanism or real-world phenomenon. Machine learners donít seem to care much about these issues, but rather are concerned about "how good" a prediction rule is. An output variable might take values in < or in some Önite set G = f 1 ; 2 ; : : : ; Kg. In this latter case, it is often convenient to replace a G-valued output with K indicator variables Yj = I [Y ^ = j] ; j = 1; 2 ; : : : ; K
(of course) each taking real values. This replaces the original Y ^ with the vector output
taking values in <K^.
For purposes of appealing to general theory that can suggest sensible forms for prediction rules, suppose that the random pair (X; Y ) has (joint) distribution P. (Until further notice all expectations refer to distributions and conditional distributions derived from P .) Suppose further that L (by; y) 0 is some loss function quantifying how unhappy I am with prediction yb when in fact Y = y. I might consider trying to choose the form of f to minimize
EL (f (X) ; Y )
This is (in theory) easily done, since
EL (f (X) ; Y ) = EE [L (f (X) ; Y ) jX]
and the minimization can be accomplished by minimizing the conditional mean for each possible value for X. That is, an optimal choice of prediction rule is deÖned by f (x) = arg min a
E [L (a; Y ) jX = x] (1)
In the simple case where L (y; yb ) = (yb y)^2 , the optimal prediction rule (1) is well known to be f (x) = E [Y jX = x] In a simple two-class classiÖcation context, where Y ^ takes values in G = f 1 ; 2 g, I might set up a decision problem with action space A = G and loss function
L (a; Y ) = I [a 6 = Y ] = I [a = 1] I [Y ^ = 2] + I [a = 2] I [Y ^ = 1]
An optimal decision rule corresponding to (1) is
a (x) =
1 if E [I [Y ^ = 1] jX = x] : 5 2 if E [I [Y ^ = 1] jX = x] < : 5
Further, if I deÖne Y = I [Y ^ = 1] this is is
a (x) =
1 if E [Y jX = x] : 5 2 if E [Y jX = x] < : 5
So in both the squared error loss context and in the 0 - 1 loss 2 -state classiÖ- cation context, (P ) optimal choice of predictor involves the conditional mean of an output variable (albeit the second is a 0 - 1 output variable). These strongly suggest the importance of Önding ways to approximate E[Y jX = x] in order to (either directly or indirectly) produce good prediction rules.
Letting
N p
x^01 x^02 .. . x^0 N
be a matrix with rows the input vectors for the N cases in the training data and
N 1
y 1 y 2 .. . yN
the corresponding vector of output values in the training set, the usual Stat 511 material says that least squares Ötting of a linear form of conditional mean to the training data can be accomplished as
b (^) = (X^0 X) ^1 X^0 Y
with corresponding predictor
Y^ b (X) = b^0 X
Regarding notation: As we must repeatedly refer to both the vector of inputs and the matrix of training values for the inputs, and considerable confusion is possible if we use the same bold face for both, I have decided to adopt the this dual notation of X for the Örst and X for the second. Since it is rare that one wants to refer to vector outputs, the notation Y will be mostly unambiguous as the (column) vector of output values in the training data.
Roughly speaking, itís clear that one wants to allow the most áexible kinds of prediction rules that a given training data set will adequately support Ötting. Naively, one might hope that with what seem like the "large" sample sizes in machine learning contexts, even if p is fairly large, highly áexible prediction rules (like k-nearest neighbor rules) might be practically useful (as points "Öll up" <p and allow one to Ögure out how Y behaves as a function of X, operating quite locally). But our intuition about how sparse data sets in <p^ actually must be is pretty weak and needs some education. There is the "curse of dimensionality" to be reckoned with. There are many ways of framing this inescapable sparsity. Some simple ones involve facts about uniform distributions on the unit ball in <p
fx 2 <pj kxk 1 g
and on a unit cube centered at the origin
[ : 5 ; :5]p
For one thing, "most" of these distributions are very near the surface of the solids. The cube [ r; :r]p^ capturing (for example) half the volume of the cube (half the probability mass of the distribution) has
r = :5 (:5)^1 =p
which converges to : 5 as p increases. Essentially the same story holds for the uniform distribution on the unit ball, except that the radius capturing half the probability mass has r = (:5)^1 =p
which converges to 1 as p increases. Points uniformly distributed in these solids are mostly near the surface or boundary of the spaces. Another interesting calculation concerns how large a sample must be in order for points generated from the uniform distribution on the ball or cube in an iid fashion to tend to "pile up" anywhere. Consider the problem of describing the distance from the origin to the closest of N iid points uniform in the unit ball. With R = the distance from the origin to a single random point
R has cdf
F (r) =
0 r < 0 rp^0 r 1 1 r > 1
So if R 1 ; R 2 ; : : : ; RN are iid with this distribution, M = min fR 1 ; R 2 ; : : : ; RN g has cdf
FM (m) =
0 m < 0 1 (1 mp)N^0 m 1 1 m > 1
This distribution has, for example, median
1 =N!^1 =p
For, say, p = 100 and N = 10^6 , the median of the distribution if M is : 87. In addition to these kinds of considerations of sparsity, there is the fact that the potential complexity of functions of p variables explodes exponentially in p.
Just as in model parameter estimation, the "variance-bias trade-o§" notion is important in a prediction context. Here we consider a decomposition of what HTF in their Section 2.9 call the "test/generalization error" that can help us think about that trade-o§. In what follows, assume that (X 1 ; Y 1 ) ; (X 2 ; Y 2 ) ; : : : ; (XN ; YN ) are iid P and independent of (X; Y ) that is also P distributed. Write EN for expectation with respect to the joint distribution of the training data
hm (x) = (x tm)+ for m = 1; 2 ; : : : ; M 2 hM 1 (x) = x and hM (x) = 1
Here predictions are piecewise linear in x. Products of such things with arguments coordinates of x 2 <p^ can be used for p > 1. Where knots are Öxed, Ötting is linear regression problem. If choosing knots is part of the Ötting process, this is a non-linear regression problem.
exp
2 m
kx mk^2
for some parameters m and m. Where these are Öxed, Ötting is linear regression problem. If choosing the m and m part of the Ötting process, this is a non-linear regression problem.
1.5.2 Methods Based on Local Smoothing/Averaging
One might try choosing a function f (x) by balancing some measure of "Öt" against a penalty associated with how "wiggly/bizarre" the function is. For p = 1, it is possible to solve for > 0 the optimization problem
f = arg min h with enough derivatives
i=
(yi h (xi))^2 +
jh^00 (x)j 2 dx
and the optimizing function is a so-called "cubic smoothing spline." The integral above might be called J (h), and the larger is , the less wiggly is f. For p > 1 , one might try considering Ötting functions of the form
h (x) =
X^ p
j=
hj (xj )
using a penalty like
X^ p
j=
J (hj )
and hope to do something generalizing the p = 1 method. Similarly, one might consider a "projection pursuit regression" model that Öts
Y^ b (x) =
m=
gm
mx
where the (^) m are unknown parameters and the real-valued functions of a sin- gle real variable gm are to be chosen as well (presumably using some penalty function idea and an iterative scheme that alternatively chooses (^) mís and gmís). Another possibility is the local use of weighted regression ideas. For some kernel function (x 0 ; x), like for example,
(x 0 ; x) =
exp
kx 0 xk^2
and some (usually fairly simple) function like
h (x) = 2 < or h (x) = 0 x
one might choose for each x 0
(x 0 ) = arg min
i=
(x 0 ; xi) (yi h (xi))^2
and then employ the prediction rule
Y^ b (x) = h (^) (x) (x)
(This produces smoothers like the loess smoother.)
The methods presented at the end of Chapter 2 all have complexity parame- ters (the number of basis functions employed, the penalty weight, and the band width/neighborhood size parameter) that must be chosen by a user. If a choice of complexity parameter doesnít allow enough áexibility in the form of a pre- dictor, under-Öt occurs and there is large bias in prediction. On the other hand, if the choice allows too much áexibility, bias may be reduced, but the price paid is large variance and over-Öt. It is a theme that runs through this material that complexity must be chosen in a way that balances variance and bias for the particular combination of N and p and general circumstance one faces. SpeciÖcs of methods for doing this are presented later in the book.
There is more to say about the development of a linear predictor
Y^ b (X) = 0 X
for an appropriate 2 <p^ than what is said in Stat 500 and Stat 511 (where least squares is used to Öt the linear form to all p input variables or to some subset of M of them). Some of that involves more linear algebra background than is assumed or used in Stat 511. We begin with some linear theory that
z 1 = x 1
zl = xl
X^ l ^1
j=
xl; zj zj ; zj
zj
It is easy enough to see that zl; zj = 0 for all j < l (building up the orthogonality of z 1 ; z 2 ; : : : ; zl 1 by induction), since
zl; zj = xl; zj xl; zj
as at most one term of the sum in step 2. above is non-zero. Further, assume that C (Zl 1 ) = C (Xl 1 ). zl 2 C (Xl) and so C (Zl) C (Xl). And since any element of C (Xl) can be written as a linear combination of an element of C (Xl 1 ) = C (Zl 1 ) and xl, we also have C (Xl) C (Zl). Thus, as advertised, C (Zl) = C (Xl). Since the zj are perpendicular, for any N -vector w,
X^ l
j=
w; zj zj ; zj
zj
is the projection of w onto C (Zl) = C (Xl). (To see this, consider minimiza-
tion of the quantity
w
Pl j=1 cj^ zj^ ;^ w^ ^
Pl j=1 cj^ zj
= w
Pl j=1 cj^ zj
2 by
choice of the constants cj .) In particular, the sum on the right side of the equality in step 2. of the Gram-Schmidt process is the projection of xl onto C (Xl 1 ). And the projection of Y onto C (Xl) is
X^ l
j=
Y; zj zj ; zj
zj
This means that for a full p-variable regression,
Y; zp zp; zp
is the regression coe¢ cient for zp and (since only zp involves it) the last vari- able in X, xp. So, in constructing a vector of Ötted values, Ötted regression coe¢ cients in multiple regression can be interpreted as weights to be applied to that part of the input vector that remains after projecting onto the space spanned by all the others. The construction of the orthogonal variables zj can be represented in matrix form as X N p
N p
pp
where is upper triangular with
kj =^ the value in the^ kth row and^ jth column of^
=
zk; xj hzk; zki
DeÖning
D = diag
hz 1 ; z 1 i^1 =^2 ; : : : ; zp; zp
= diag (kz 1 k ; : : : ; kzpk)
and letting Q = ZD ^1 and R = D
one may write X = QR (3)
that is the so-called QR decomposition of X. In (3), Q is N p with
Q^0 Q = D^0 Z^0 ZD = D^0 diag
hz 1 ; z 1 i ; : : : ; zp; zp
That is, Q has for columns perpendicular unit vectors that form a basis for C (X). R is upper triangular and that says that only the Örst l of these unit vectors are needed to create xl. The decomposition is computationally useful in that (for qj the jth column of Q) the projection of Y onto C (X) is (since the qj comprise an orthonormal basis for C (X))
Y^ b =
X^ p
j=
Y; qj qj = QQ^0 Y (4)
and b OLS = R ^1 Q^0 Y
(The fact that R is upper triangular implies that there are e¢ cient ways to compute its inverse.)
The matrix X has a so-called singular value decomposition as
X N p
N p
pp
pp
where U has orthonormal columns spanning C (X), V has orthonormal columns spanning C (X^0 ) (the row space of X), and D = diag(d 1 ; d 2 ; : : : ; dp) for
d 1 d 2 dp > 0
The dj are the "singular values" of X.
is the sample covariance (and correlation) matrix for the p input variables X 1 ; X 2 ; : : : ; Xp.
An alternative to seeking to Önd a suitable level of complexity in a linear predic- tion rule through subset selection and least squares Ötting of a linear form to the selected variables, is to employ a shrinkage method based on a penalized ver- sion of least squares to choose a vector 2 <p^ to employ in a linear prediction rule. Here we consider several such methods. The implementation of these methods is not equivariant to the scaling used to express the input variables Xj. So that we can talk about properties of the methods that are associated with a well-deÖned scaling, we assume here that the output variable has been centered (i.e. that hY; 1 i = 0) and that the columns of X have been standardized (and if originally X had a constant column, it has been removed).
2.3.1 Ridge Regression
For a > 0 the ridge regression coe¢ cient vector 2 <p^ is
b ridge = arg min 2<p
i=
@yi
X^ p
j=
j xij
2
X^ p
j=
2 j
Here is a penalty/complexity parameter that controls how much b^
OLS is shrunken towards 0. The unconstrained minimization problem expressed in (6) has an equivalent constrained minimization description as
b ridge t = arg min with Pp j=1 2 j t
i=
@yi
X^ p
j=
j xij
2 (7)
for an appropriate t > 0. (Corresponding to used in (6), is t = b^
ridge
2
used in (7). Conversely, corresponding to t used in (7), one may use a value of in (6) producing the same error sum of squares.) The unconstrained form (6) calls upon one to minimize
(Y X )^0 (Y X ) + 0
and some vector calculus leads directly to
b ridge = (X^0 X + I) ^1 X^0 Y
So then, using the singular value decomposition of X,
Y^ b ridge = Xb^ ridge = U DV 0
X^ p
j=
d^2 j d^2 j +
Y; uj uj (8)
Comparing to (5) and recognizing that
d^2 j+ d^2 j+1 +
d^2 j d^2 j +
we see that the coe¢ cients of the orthonormal basis vectors uj employed to
get Yb
ridge are shrunken version of the coe¢ cients applied to get Yb
OLS : The most severe shrinking is enforced in the directions of the smallest principal components of X (the uj least important in making up low rank approximations to X). The function
df () = tr