model assessment and selection - max planck society

64
First Prev Next Last Go Back Full Screen Close Quit Model Assessment and Selection Axel Benner Biostatistics, German Cancer Research Center INF 280, D-69120 Heidelberg [email protected]

Upload: others

Post on 15-May-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment

and

Selection

Axel Benner

Biostatistics, German Cancer Research Center

INF 280, D-69120 Heidelberg

[email protected]

Page 2: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 2

Topics

Predictive Ability using Resampling

• Data-Splitting/Cross-Validation

• The Bootstrap

Controlling Model Complexity

• Restriction

• Selection

• Regularization

Page 3: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 3

Model: A current approximation to complex relationships

Page 4: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 4

Predictive Accuracy

• Some models are used only for hypothesis testing

• If used for prediction, need to consider accuracy of predictions

• Two major aspects of predictive accuracy that need to be assessed:

– Reliability or calibration of a model:“ability of the model to make unbiased estimates of the out-come”(“observed responses agree with predicted responses”)

– Discrimination ability:“model is able, through the use of predicted responses, to sepa-rate subjects”

Page 5: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 5

Major problem is overfitting

Low HighModel Complexity

Training Sample

High BiasLow variance

Low BiasHigh variance

Pre

dict

ion

Err

or Behaviour of training sample error

as the model complexity is varied

Page 6: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 6

Need: Model assessment/validation to ascertain whether predictedvalues from the model are likely to accurately predict responses onfuture subjects or subjects not used to develop the model

• Two modes of validation

– External:Use different sets of subjects for building the model (includingtuning) and testing

– Internal:(i) Apparent (evaluate fit on same data used to create fit)(ii) Data splitting and its extensions(iii) Resampling methods

Page 7: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 7

• Naive approach: Use the entire training data to select our predic-tor/classifier and estimate the error rate

– The naive approach has two fundamental problems

∗ The final model will overfit the training data. This problemis more pronounced with models that have a large number ofparameters.

∗ The error rate estimate will be overly optimistic (lower thanthe true error rate). “In fact, it is not uncommon to have100% correct classification on training data”

• A much better idea is to split the training data into disjoint subsetsor use resampling methods

Page 8: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 8

Low HighModel Complexity

Training Sample

Test Sample

High BiasLow variance

Low BiasHigh variance

Pre

dict

ion

Err

or Behaviour of test and training sample error

as the model complexity is varied

Page 9: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 9

One-Time Data-Splitting

Split samples into two parts at random with balancing distributions ofthe response (and predictor variables)

• Training Set: Model development

• Test or Assessment Set: Measure predictive accuracy

Intelligent Sensor SystemsRicardo Gutierrez-OsunaWright State University

4

The holdout methodg Split dataset into two groups

n Training set: used to train the classifiern Test set: used to estimate the error rate of the trained classifier

g A typical application the holdout method is determining a stopping point for the back propagation error

Training Set Test Set

Total number of samples

Epochs

MSE

Training set error

Test set errorStopping point

Sometimes, a chronological split is used so that the validation isprospective.

Page 10: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 10

One-Time Data-Splitting

The one-time data-splitting method has two basic drawbacks

• In problems where we have a sparse data set we may not be ableto afford the “luxury” of setting aside a portion of the data set fortesting (“significant loss of power”)

• The assessment can vary greatly when taking different splits.Since it is a single train-and-test experiment, the estimate of theerror rate will be misleading if we happen to get an “unfortunate”split.

Page 11: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 11

Cross-Validation

• K-fold cross-validation

Intelligent Sensor SystemsRicardo Gutierrez-OsunaWright State University

7

K-Fold Cross-validationg Create a K-fold partition of the the dataset

n For each of K experiments, use K-1 folds for training and the remaining one for testing

g K-Fold Cross validation is similar to Random Subsampling n The advantage of K-Fold Cross validation is that all the examples in the

dataset are eventually used for both training and testing

g As before, the true error is estimated as the average error rate

Total number of samples

Experiment 1

Experiment 2

Experiment 3Test samples

Experiment 4

∑=

=K

1iiE

K1

E

• Leave-One-Out cross-validation

Intelligent Sensor SystemsRicardo Gutierrez-OsunaWright State University

8

Leave-one-out Cross Validationg Leave-one-out is the degenerate case of K-Fold Cross

Validation, where K is chosen as the total number of examplesn For a dataset with N examples, perform N experiments

n For each experiment use N-1 examples for training and the remaining example for testing

g As usual, the true error is estimated as the average error rate on test examples

∑=

=N

1iiE

N1

E

Total number of samples

Experiment 1

Experiment 2

Experiment 3

Experiment N

Single test sample

Results are pooled from all test sets to estimate performance of themodel (each case is used exactly once).

Page 12: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 12

(Aggregate) Prediction Error

General notation:

• Let y denote the response variable and x the covariate vector.

• Let y+ and x+ denote response and covariate values for a new case.

• Measure the prediction error by loss function: c(y+, y+)

• Prediction rule: y+ = µ(x+, F )

where F is the empirical distribution function sampled from dis-tribution F

• (Aggregate) prediction error

D = D(F, F ) = E[c(Y+, µ(X+, F ))|F ]

−→ Use an estimate of D, say ∆ = ∆(F )

Page 13: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 13

Misclassification error (two groups)

• Suppose a response y which is equal 1 or 0.

• The prediction rule µ(x+, F ) is an estimate of P (Y+ = 1|x+) fora new case (x+, y+).

• Set y+ = 1 if µ(x+, F ) ≥ 0.5 and y+ = 0 otherwise.

• If misclassifications costs are equal, the misclassification loss func-tion is

c(y+, y+) =

{1, y+ 6= y+0, otherwise

• The aggregate prediction error D is then the overall misclassifi-cation rate, equal to the proportion of cases where y+ is wronglypredicted.

Page 14: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 14

• Apparent error (resubstitution error):

Use the same data for prediction which was used for fitting themodel

∆app = D(F , F ) =1

n

n∑i=1

c(yi, µ(xi, F ))

∆app underestimates the true ∆ (“it is downwardly biased”)

Page 15: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 15

• Leave-one-out Cross-Validation

Training sets of size (n− 1) are taken and prediction rule is testedfor a single observation:

∆cv =1

n

n∑i=1

c(yi, µ(xi, F−i))

where F−i represents the data excluding the i-th case.

Note the small bias of leave-one-out cv:

“It differs from ∆ by terms of order n−2 (whereas the apparenterror differs by terms of order n−1)”.

Page 16: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 16

• K-fold Cross-Validation

Since the n training sets are so similar to one another this can

make ∆cv too variable

→ leave out groups of observations; especially K disjoined groups

∆cv,K =1

n

n∑i=1

c(yi, µ(xi, F−k(i)))

where F−k(i) represents the data excluding the group containingthe i-th case.

Page 17: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 17

• K-fold Cross-Validation: Training set size bias

0.0

0.2

0.4

0.6

0.8

Size of training set

1−E

rr

0 25 50 75 100 125 150 175 200

Hypothetical learning curve: The performance of the predictor im-proves as the training set size increases to about 100 observations.

Increasing this number further brings only a small benefit.

Page 18: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 18

• Leave-one-out vs. K-fold Cross-ValidationCross Validation ExtremesK=2 K=n

Smaller training sets with less overlap

Larger test set

Larger training sets with more overlap

Smaller test set

Training set size bias Lower variance thanLeave-One-Out Overestimates prediction error

K-fold

Computationally expensive High variance

Effective use of dataNearly unbiased estimateof the prediction error

Leave-One- Out (K=n)

DisadvantagesAdvantages

Page 19: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 19

• K-fold Cross-Validation (cont)

– Good strategy: Take K = min(√

n, 10)A size of at least

√n should perturb the data sufficiently to give

small variance.

– Problem: increasing bias (especially if K is small)!“overestimation of the prediction error depending on the train-ing sample size”

→ Reduce bias by adjustment:

Denote by F−k the data with the k-th group omitted, k =1, ..., K, and let pk denote the proportion of the k-th group inthe data set.

∆acv,K = ∆cv,K + D(F , F )−K∑

k=1

pkD(F , F−k)

Page 20: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 20

K-fold Adjusted Cross-Validation

1. Fit the regression model to all cases, calculate predictions yi from

that model, and average the values of c(yi, yi) to get D(F , F ).

2. Choose group sizes m1, ...,mK such that m1 + ... + mK = n.

3. For k = 1, ..., K

(a) choose Ck by sampling mk times without replacement from{1,2,...,n} minus elements chosen for previous Cis

(b) fit the regression model to all data except cases i ∈ Ck

(c) calculate new predictions yi = µ(xi, F−k) for i ∈ Ck

(d) calculate predictions yki = µ(xi, F−k) for all i; then

(e) average the n values c(yi, yki) to give D(F , F−k).

4. Average the n values of c(yi, yi) using yi from step 3(c) to give

∆cv,K.

5. Calculate ∆acv,K = ∆cv,K + D(F , F )−∑K

k=1 pkD(F , F−k) withpk = mk/n.

Page 21: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 21

Drawbacks of Cross-Validation

• Leave-one-out cv: may have large variance

• K-fold cv: may have large bias, depending on the choice of thenumber of observations to be hold out from each fit.

If the learning curve has a considerable slope at the given trainingset size, 5 or 10-fold cv will strongly overestimate the true predic-tion error.

Page 22: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 22

Estimate Prediction Error (Bootstrap)

The bootstrap estimate of the prediction error is

∆ = ∆(F ) = E(D(F , F ∗b))

where F ∗b denotes a bootstrap sample (x∗b1 , y∗b1 ), . . . , (x∗bn , y∗bn ) of theoriginal data.

Now the prediction rule is fitted to these data resulting in predictions

µ(xi, F∗b) of yi.

Using a loss function c(·) ∆ is then approximated by

∆b =1

B

B∑b=1

1

n

n∑i=1

c(yi, µ(xi, F∗b))

derived by fitting the model on a set of bootstrap samples, and com-paring its predictions with the original data.

Page 23: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 23

Problem: Bootstrap sample act as training sample, and originaltraining set act as test set.

Both samples have observations in common

→ overoptimistic estimate due to overfitting

→ underestimates the error

Page 24: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 24

• Alternative 1: Leave-one-out bootstrap estimate of prediction error

∆bcv =1

n

n∑i=1

1

|B−i|∑b∈B−i

c(yi, µ(xi, F∗b))

B−i is set of indices that does not contain observation i and |B−i|is the size of this set.

Note that |B−i|/B is approximately equal to e−1 = 0.368

∆bcv is a bootstrap smoothing of the leave-one-out cv.

→ overfitting no problem, but (like cv) bias by training set size.

→ possibly overestimates error rate.

Page 25: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 25

Example: 6 bootstrap samples

original data 1 2 3 4 5bootstrap sample 1 1 1 3 4 4bootstrap sample 2 1 2 2 3 5bootstrap sample 3 1 3 3 3 4bootstrap sample 4 3 4 4 5 5bootstrap sample 5 2 2 3 4 4bootstrap sample 6 1 1 2 4 5

Now bootstrap samples 1,3,and 4 do not include observation 2.And so we get: B−2 = {1, 3, 4} with |B−2| = 3.

Page 26: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 26

• Alternative 2: “.632” bootstrap estimate of prediction error

∆.632 = .368∆app + .632∆bcv

where ∆app is the apparent error estimate

pulls leave-one-out down toward training error

→ may underestimate the error in overfitting situations

∆app^ ∆bcv

^

Less overfitting

More overfitting

∆.632^

Page 27: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 27

• Problem: ∆.632 can break down in overfitted situation

→ take into account amount of overfitting.

→ put relatively more weight on ∆bcv

→ ”.632+” bootstrap estimate of prediction error

This estimate was proposed by Efron & Tibshirani (JASA, 1997)for highly overfit rules like nearest neighbors.

Page 28: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 28

• Alternative 3: ”.632+” bootstrap estimate of prediction error

∆.632+ = (1− w) · ∆app + w · ∆bcv

where the weight w is given by

w =.632

1− .368R.

and where

R =∆bcv − ∆app

γ − ∆app

is the ”relative overfitting rate”.

γ denotes the ”no information error rate” that would apply if inputand output are independent

γ =1

n2

n∑i=1

n∑i′=1

c(yi, µ(xi′, F∗b))

Page 29: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 29

• For classification problems γ is estimated by

γ =

g∑i=1

pi(1− qi)

where g is the number of different classes, pi is the proportion ofthe original cases from the ith class (= prior probability of class i),and qi is the proportion assigned to the ith class by the predictionrule (= posterior probability of class i).

• R may have to be truncated to not fall outside [0, 1].

• w varies from 0.632 (R = 0) to 1.0 (R = 1).

• ∆.632+ puts more weight on the bootstrap leave-one-out error ∆bcv

when the amount of overfitting (∆bcv − ∆app) is large.

• Use ∆.632+ if the prediction rule is overfit due to feature selection.

Page 30: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 30

Bootstrap overview

∆∆∆∆b^

Underestimates error due to overlapin assessment and training sets

∆∆∆∆bcv^

Can overestimate error due to training set

size bias

∆∆∆∆.632^

Underestimates error inoverfitting situations

∆∆∆∆.632+^

Page 31: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 31

• ∆bcv is based on ≈ .632×n of the original cases and closely agreeswith the ”half-sample” cross-validation and therefore it is upwardlybiased.

→ Use ”.632” estimator (Efron, 1983) to correct for the upward

bias in ∆bcv with the downward bias in the apparent error estimate.

• In gene expression studies the prediction rule is an overfit formedfrom a large number of genes relative to the number of cases.

→ Use ”.632+” estimator (Efron & Tibshirani, 1997) to put rel-

atively more weight on ∆bcv (preferably in overfit situations likefeature selection).

Page 32: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 32

Misclassification error (two groups)

• The prediction µ(x+, F ) and the measure of error c(y+, y+) arenot continuous functions of the data.

→bootstrap methods for estimating D or its expected value ∆ aresuperior to cross-validation methods, in terms of variability.

Page 33: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 33

Variable/Gene Selection

• Model/variable selection implies that there is some likelihood of a“true” model,

some pre-specified variables have zero association with response Y

• Need to perform gene selection preceding the predictive modelling

→ e.g. eliminate variables whose distributions are too narrow.

Page 34: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 34

Variable/Gene Selection (cont)

• Gene filtering is helpful, but

estimating the error rate after variable selection leads to biasedestimates of the prediction error→ overstating importance of variables which are retained in themodel.

• Make sure that you are cross-validating the experiment that youhave carried out,in particular, if you are selecting genes, rather than working withknown genes, you must cross-validate the gene selection process aswell.

• There are many examples with low classification error rates whichdo not cross-validate properly (model/gene selection was not vali-dated).

Page 35: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 35

Ambroise & McLachlan (PNAS, 2002): Selection bias in geneextraction on the basis of microarray gene-expression data

... it seems that the selection method and the number of se-lected genes are more important than the classification methodfor constructing a reliable prediction rule.

... it is important to correct for the selection bias in estimatingthe prediction error for a rule formed by using a subset of genesselected from a very large set of available genes.

Page 36: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 36

Prediction error in gene selection situations

Example: The expression set Huang.RE which is discussed in THELANCET (2003) 361:1590-1596. The data contains microarrays of 52women with breast cancer of whom 34 did not experience a recurrenceof the tumour during a 3 years time period.

For simplicity select 1000 most variable probe sets (e.g. by largestvariability) for the exercises (data frame mydata)

library(affy)sd.exp <- apply(exprs(Huang.RE),1,sd)index <- order(sd.exp,decreasing=TRUE)[1:1000]

mydata <- data.frame(t(exprs(Huang.RE)[index,]),Recurrence=as.factor(pData(Huang.RE)$Recurrence))

Page 37: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 37

Now we select probe sets by comparing their univariate p-values of atwo-sample t-test with a pre-specified level of 0.05 and train a LDAusing the selected probe sets only (function mymod).

mymod <- function(formula, data, level = 0.05) {sel <- which(lapply(data, function(x) {

if (!is.numeric(x))return(1)

else return(t.test(x ~ data$Recurrence)$p.value)}) < level)sel <- c(which(colnames(data) %in% "Recurrence"), sel)mod <- lda(formula, data = data[, sel])function(newdata) {predict(mod, newdata = newdata[, sel])$class}}

Page 38: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 38

The .632+ bootstrap estimate of the prediction error using B=25bootstrap samples gives a misclassification rate of 0.27.

library(ipred)set.seed(71003)errorest(Recurrence ~ ., data=mydata, model=mymod, estimator="632plus",

est.para=control.errorest(nboot=25))

errorest.data.frame(formula=Recurrence ~ ., data=mydata,model=mymod, estimator="632plus", est.para=control.errorest(nboot=25))

.632+ Bootstrap estimator of misclassification errorwith 25 bootstrap replications

Misclassification error: 0.2705

Page 39: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 39

Define a gene expression set of 1000 genes with no association to theresponse

set.seed(63321)mydata <- data.frame(matrix(rnorm(52*1000),52,1000),

Recurrence=as.factor(pData(Huang.RE)$Recurrence))

Page 40: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 40

1. Select genes by individual t tests (selection level 0.05), perform alda using the selected subset and compute estimate of the misclassifi-cation error (ignoring the selection process)

sel <- which(lapply(mydata, function(x) {if (!is.numeric(x)) return(1)else return(t.test(x ~ mydata$Recurrence)$p.value)

}) < 0.05)sel <- c(which(colnames(mydata) %in% "Recurrence"), sel)mypredict.lda <- function(object, newdata) {predict(object, newdata = newdata)$class}errorest(Recurrence ~ ., data = mydata[, sel],model = lda, estimator = "632plus", predict = mypredict.lda)

Call:errorest.data.frame(formula = Recurrence ~ ., data = mydata[,

sel], model = lda, predict = mypredict.lda, estimator = "632plus")

.632+ Bootstrap estimator of misclassification errorwith 25 bootstrap replications

Misclassification error: 0.1005

Page 41: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 41

2. Now repeat the error estimation taking into account the geneselection by individual t tests (using 25 bootstrap samples)

errorest(Recurrence ~ ., data=mydata, model=mymod,estimator="632plus", est.para=control.errorest(nboot=25))

Call:errorest.data.frame(formula = Recurrence ~ ., data = mydata,

model = mymod, estimator = "632plus",est.para = control.errorest(nboot = 25))

.632+ Bootstrap estimator of misclassification errorwith 25 bootstrap replications

Misclassification error: 0.3447

Page 42: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 42

3. Finally repeat the error estimation taking into account the geneselection by individual t tests (using 7-fold cross validation)

errorest(Recurrence ~ ., data=mydata, model=mymod,estimator="cv", est.para=control.errorest(k=7))

Call:errorest.data.frame(formula = Recurrence ~ ., data = mydata,

model = mymod, estimator = "cv", est.para = control.errorest(k = 7))

7-fold cross-validation estimator of misclassification error

Misclassification error: 0.4231

Note: The true misclassification rate is 1− 34/52 = 0.346.

Result of this example:Ignoring the selection process results in an error estimate of 10%.The .632+ bootstrap estimate of 0.345 is nearly correct, while the7-fold cross-validation overestimates the error.

Page 43: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 43

From: Ambroise & McLachlan (PNAS, 2002)

available genes. To illustrate this selection bias further, wegenerated a no-information training set by randomly permutingthe class labels of the colon tissue samples. For each of these 20no-information sets, an SVM rule was formed by selecting genesby the RFE method, and the AE and the leave-one-out CV errorCV1IE were calculated. The average values of these two errorrates and the no-information error � (Eq. 3) over the 20 sets areplotted in Fig. 5, where we also plotted the average value of the

CV10E and B.632� error estimates that correct for the selectionbias. It can be seen that although the feature vectors have beengenerated independently of the class labels, we can form an SVMrule that has not only an average zero AE but also an averageCV1IE error close to zero for a subset of 128 genes and �10%for only eight genes in the selected subset. It is reassuring to seethat the error estimates CV10E and B.632�, which correct forthe selection bias, are between 0.40 and 0.45, consistent with thefact that we are forming a prediction rule on the basis of ano-information training set.

From the three examples presented, it can be seen that it isimportant to recognize that a correction for the selection bias bemade in estimating the prediction error of a rule formed by usinggenes selected from a very large set of available genes. It isimportant also to note that if a test set is used to estimate theprediction error, then there will be a selection bias if this test setwas used also in the gene-selection process. Thus the test setmust play no role in the feature-selection process for an unbiasedestimate to be obtained.

Given that there is usually only a limited number of tissuesamples available for the training of the prediction rule, it isnot practical for a subset of tissue samples to be put aside fortesting purposes. However, we can correct for the selectionbias either by cross-validation or the bootstrap as implementedabove in the examples. Concerning the former approach, aninternal cross-validation does not suffice. That is, an externalcross-validation must be performed whereby at each stage ofthe validation process with the deletion of a subset of theobservations for testing, the rule must be trained on theretained subset of observations by performing the samefeature-selection procedure used to train the rule in the firstinstance on the full training set.

1. Xiong, M., Li, W., Zhao, J., Jin, L. & Boerwinkle, E. (2001) Mol. Genet. Metab.73, 239–247.

2. Dudoit, S. Fridlyand, J. & Speed, T. P. (2002) J. Am. Stat. Assoc. 97, 77–87.3. Xiong, M., Fang, X. & Zhao, J. (2001) Genome Res. 11, 1878–1887.4. Zhang, H., Yu, C.-Y., Singer, B. & Xiong, M. (2001) Proc. Natl. Acad. Sci. USA

98, 6730–6735.5. Golub, T. R., Slonim, D. K., Tamayo, P., Huard, C., Gassenbeck, M., Mesirov,

J. P., Coller, H., Loh, M. L., Downing, J. R., Caligiuri, M. A., et al. (1999)Science 286, 531–537.

6. Moler, E. J., Chow, M. L. & Mian, I. S. (2000) Physiol. Genomics 4,109–126.

7. Chow, M. L., Moler, E. J. & Mian, I. S. (2001) Physiol. Genomics 5, 99–111.8. Nguyen, D. V. & Rocke, D. M. (2001) in Methods of Microarray Data Analysis,

eds. Lin, S. M. & Johnson, K. F. (Kluwer, Dordrecht, The Netherlands), pp.109–124.

9. Guyon, I., Weston, J., Barnhill, S. & Vapnik, V. (2002) Mach. Learn. 46,389–422.

10. Eisen, M. B., Spellmann, P. T., Brown, P. O. & Botstein, D. (1998) Proc. Natl.Acad. Sci. USA 195, 14863–14868.

11. Alon, U., Barkai, N., Notterman, D. A., Gish, K., Ybarra, S., Mack, D. &Levine, A. J. (1999) Proc. Natl. Acad. Sci. USA 96, 6745–6750.

12. Ben-Dor, A., Bruhn, L., Friedman, N., Nachman, I., Schummer, M. & Yakhini,Z. (2000) J. Comp. Biol. 7, 559–584.

13. Getz, G., Levine, E. & Domany, E. (2000) Proc. Natl. Acad. Sci. USA 97,12079–12084.

14. Sorlie, T., Perou, C. M., Tibshirani, R., Aas, T., Geisler, S. Johnsen, H., Hastie,T., Eisen, M. B., van de Rijn, M., Jeffrey, S. S., et al. (2001) Proc. Natl. Acad.Sci. USA 98, 10869–10874.

15. McLachlan, G. J., Bean, R. W. & Peel, D. (2002) Bioinformatics 18, 413–422.16. Furey, T. S., Cristianini, N., Duffy, N., Bednarski, D. W., Schummer, M. &

Haussler, D. (2000) Bioinformatics 16, 906–914.17. Brown, M. P. S., Grundy, W. N., Lin, D., Cristianini, N., Sugnet, C. W., Furey, T. S.,

Ares, M., Jr. & Haussler, D. (2000) Proc. Natl. Acad. Sci. USA 97, 262–267.18. Kudo, M. & Sklansky, J. (2000) Pattern Recognit. 33, 25–41.19. Kohavi, R. & John, G. H. (1996) Artif. Intell. 97, 273–324.20. McLachlan, G. J. (1992) Discriminant Analysis and Statistical Pattern Recogni-

tion (Wiley, New York).21. Efron, B. (1979) Ann. Statist. 7, 1–26.22. Efron, B. & Tibshirani, R. (1997) J. Am. Stat. Assoc. 92, 548–560.23. Efron, B. (1983) J. Am. Stat. Assoc. 78, 316–331.24. Roth, F. P. (2001) Genome Res. 11, 1801–1802.25. Spang, R., Blanchette, C., Zuzan, H., Marks, J. R., Nevins, J. R. & West, M.

(2001) In Silico Biol., www.bioinfo.de�isb�gcb01�talks�spang�.26. West, M., Blanchette, C., Dressman, H., Huang, E., Ishida, S., Spang, R.,

Zuzan, H., Olsen, J. A., Jr., Marks, J. R., Nevins, J. R., et al. (2001) Proc. Natl.Acad. Sci. USA 98, 11462–11467.

Fig. 5. Error rates of the SVM rule averaged over 20 noninformative samplesgenerated by random permutations of the class labels of the colon tumortissues.

6566 � www.pnas.org�cgi�doi�10.1073�pnas.102102699 Ambroise and McLachlan

Page 44: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 44

Intelligent Sensor SystemsRicardo Gutierrez-OsunaWright State University

4

The holdout methodg Split dataset into two groups

n Training set: used to train the classifiern Test set: used to estimate the error rate of the trained classifier

g A typical application the holdout method is determining a stopping point for the back propagation error

Training Set Test Set

Total number of examples

Model complexity

Error

Training set error

Test set errorStopping point

Page 45: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 45

Separate Test and Validation Sets

• The error rate estimate of the final model on test data will bebiased since the test set is used to select the final model

• If model selection and error estimates are to be computed simulta-neously, we need an additional validation set:

– Training set:Used to fit the model

– Test (or assessment set):Used to tune the parameters of a predictor

– Validation set:A set of cases used only to assess the performance of a fully-trained predictor.

After assessing the final model with the validation set, YOU MUSTNOT further tune the model.

Page 46: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 46

Topics

Predictive Ability using Resampling

• Data-Splitting/Cross-Validation

• The Bootstrap

Controlling Model Complexity

• Restriction

• Selection

• Regularization

Page 47: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 47

Controlling the complexity of the model

Truth

Hastie, Tibshirani, Friedman, 2001

Page 48: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 48

Truth

Hastie, Tibshirani, Friedman, 2001

Realization

Page 49: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 49

Truth

Hastie, Tibshirani, Friedman, 2001

Realization

estimationvariance

model space

modelbias

closest fit

Page 50: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 50

Truth

Hastie, Tibshirani, Friedman, 2001

Realization

estimationvariance

model space

modelbias

closest fit

restrictedmodel space

regularizationbias

shrunken fit

Page 51: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 51

Controlling the complexity of the model

• Restriction methods

The class of functions of the input variables defining the model islimited.

Example:Allow only linear combinations of given basis functions hjm

f (X) =

G∑j=1

fj(Xj) =

G∑j=1

Mj∑m=1

βjmhjm(Xj)

hjm is the mth basis function of the jth input variable.

The size of the model is limited by the number Mj of basis functionsused for the G components fj.

Page 52: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 52

Controlling the complexity of the model

• Selection methods

Include only those basis functions hjm that contribute ‘signifi-cantly’ to the fit of the model.

Examples:

– Variable selection methods

– Stagewise greedy approaches like boosting

• Regularization methods

Restrict the coefficients of the model.

Example: Ridge regression

Page 53: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 53

Penalized Regression

• Maximizing the log likelihood can result in fitting noise in the data.

• A shrinkage approach will often result in estimates of the regressioncoefficients that, while biased, are lower in mean squared error andare more close to the true parameters.

• A good approach to shrinkage is penalized maximum likelihoodestimation (le Cessie & van Houwelingen, 1990).

From the log-likelihood logL a so-called ‘penalty’ is subtracted,that discourages regression coefficients to become large.

→ penalized log likelihood:

logL− λ · p(β)

p(β) penalty function, λ non-negative penalty factor.

Page 54: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 54

Penalized Regression

• Often used penalty function:Quadratic regularization (ridge regression)

p(β) =1

2

G∑j=1

β2j

• Harrell (2001):Use scaling constants s1, s2, ..., sG, chosen to make sjβj unitless

p(β) =1

2

G∑j=1

(sjβj)2

Page 55: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 55

Choice of λ

• AIC (Akaike’s Information Criterion):

−2logLik + 2d.f.

For a given λ the effective number of parameters being estimatedis reduced because of shrinkage → effective degrees of freedom (cp.Gray, 1992)

d.f. = trace(I(βp) · V (βp))

βp is penalized MLE; I is information matrix ignoring the penaltyand V is covariance matrix computed by inverting the informationmatrix that included the second derivatives with respect to β inthe penalty.

• Alternative: Cross validation (and smoothing on the pairs{λ, predictive accuracy}).

Page 56: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 56

Applications

• DataBlood samples of a subset of 101 patients, randomly selected from astudy of 325 B-cell chronic lymphocytic leukemia (B-CLL) patients

– Affymetrix Human Genome U95 array (version 1 and 2):Gene expression values for 12600 probe sets

– Array normalization:Robust Multichip Average (RMA) procedure (Irizarry et al.,2003).

Median follow up was 28 months since date of the genetic study.

A prognostic survival model was build using clinical data, molecu-lar cytogenetic data and microarray measurements.

For demonstration purposes we use only genes (i.e. probe sets) asinput variables, thus ignoring cytogenetic and clinical features.

Page 57: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 57

Survival since date of genetic study of 101 B-CLL patients.

Time since genetic study (months)

Sur

viva

l rat

e (%

)

0 12 24 36 48 60 72

020

4060

8010

0

Number at risk: 101 95 78 58 45 33 20

Median survival 54 months (18 patients died).

Page 58: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 58

Classification

• Immunoglobulin variable heavy chain (IgVH) gene mutation statusis a strong prognostic marker for survival of patients with B-CLLPatients without gene mutation of the IgVH region → worseprognosis.

• Task: Discriminate observations into the two categories character-ized by the IgVH mutation status by using gene expression data.The outcome variable of interest is y = 1 if no IgVH mutationwas observed and zero otherwise.

• For two of the patients no information on the IgVH mutation statuswas available.

Page 59: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 59

Survival since date of genetic study of 99 B-CLL patients according totheir IgVH mutation status.

Time since genetic study (months)

Sur

viva

l rat

e (%

)

With IgVH mutation

Without IgVH mutation

0 12 24 36 48 60 72

020

4060

8010

0

Number at risk:

With IgVH mutationWithout IgVH mutation

4851

4542

3128

1420

67

23

10

Page 60: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 60

Penalized Regression (p >> n)

• The dimension of the resulting systems of equations is of the sizeof numbers of genes

• Can be reduced using singular value decomposition to a size corre-sponding to the (much smaller) number of observations (Eilers etal., 2001).

Page 61: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 61

Binomial log-likelihood loss and L2-penalty

logLλ =∑n

i=1 yilog(pi) +∑n

i=1(1− yi)log(1− pi) + 12λ

∑Gj=1 β2

j

●●

● ● ●

●●

● ● ●

0 1 2 3 4 5

115

120

125

130

135

Akaike's Information Criterion

log lambda

AIC

●●

●●

● ● ● ● ● ● ●

0 1 2 3 4 5

010

2030

4050

60

Effective degrees of freedom

log lambda

df

Minimum AIC at log(λ)=1.75 (effective d.f.=31.26)

Page 62: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 62

(Unscaled and scaled) parameter estimates

0 2000 6000 10000

−0.

15−

0.05

0.05

0.10

0.15

Gene number

Reg

ress

ion

coef

ficie

nts

0 2000 6000 10000

−0.

15−

0.05

0.05

0.10

0.15

Gene number

Sca

led

regr

essi

on c

oeffi

cien

ts

Page 63: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 63

●● ●

● ●

●●

●●

●●

● ●

●●

●●

●●

0.88 0.90 0.92 0.94 0.96 0.98 1.00

0.0

0.2

0.4

0.6

0.8

1.0

IgVH homology

Est

imat

ed p

roba

bilit

yall data

●●

●●●

●●

●●●

● ●●

0.88 0.90 0.92 0.94 0.96 0.98 1.00

0.0

0.2

0.4

0.6

0.8

1.0

IgVH homology

Est

imat

ed p

roba

bilit

y

10fold cross−validation

IgVH mutationno yes

All data no 45 3yes 3 48

IgVH mutationno yes

10-fold cv no 35 16yes 13 35

Page 64: Model Assessment and Selection - Max Planck Society

•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit

Model Assessment and Selection 64

References

• Ambroise C, McLachlan GJ (2002). Selection bias in gene extrac-tion on the basis of microarray gene-expression data. Proc. Natl.Acad. Sci. USA, 99, 6562-6566.

• Davison AC, Hinkley DV (1997). Bootstrap Methods and TheirApplications. Cambridge University Press.

• Harrell FE (2001). Regression Modeling Strategies. Springer-Verlag.

• Hastie T, Tibshirani R, Friedman JH (2001). The Elements ofStatistical Learning. Springer-Verlag.

R Packages

• Prediction: ipred, pamr, Design.

• Bootstrap: boot, Design.