Presentation is loading. Please wait.

Presentation is loading. Please wait.

Optimization methods Morten Nielsen Department of Systems Biology, DTU.

Similar presentations


Presentation on theme: "Optimization methods Morten Nielsen Department of Systems Biology, DTU."— Presentation transcript:

1 Optimization methods Morten Nielsen Department of Systems Biology, DTU

2 Outline Optimization procedures –Gradient decent –Monte Carlo Overfitting –cross-validation Method evaluation

3 Linear methods. Error estimate I1I1 I2I2 w1w1 w2w2 Linear function o

4 Gradient decent (from wekipedia) Gradient descent is based on the observation that if the real-valued function F(x) is defined and differentiable in a neighborhood of a point a, then F(x) decreases fastest if one goes from a in the direction of the negative gradient of F at a. It follows that, if for  > 0 a small enough number, then F(b)<F(a)

5 Gradient decent (example)

6 Gradient decent

7 Weights are changed in the opposite direction of the gradient of the error

8 Gradient decent (Linear function) Weights are changed in the opposite direction of the gradient of the error I1I1 I2I2 w1w1 w2w2 Linear function o

9 Gradient decent Weights are changed in the opposite direction of the gradient of the error I1I1 I2I2 w1w1 w2w2 Linear function o

10 Gradient decent. Example Weights are changed in the opposite direction of the gradient of the error I1I1 I2I2 w1w1 w2w2 Linear function o

11 Gradient decent. Example Weights are changed in the opposite direction of the gradient of the error I1I1 I2I2 w1w1 w2w2 Linear function o

12 Gradient decent. Doing it your self Weights are changed in the opposite direction of the gradient of the error 10 W 1 =0.1W 2 =0.1 Linear function o What are the weights after 2 forward (calculate predictions) and backward (update weights) iterations with the given input, and has the error decrease (use  =0.1, and t=1)?

13 Fill out the table itrW1W2O 00.1 1 2 What are the weights after 2 forward/backward iterations with the given input, and has the error decrease (use  =0.1, t=1)? 10 W 1 =0.1W 2 =0.1 Linear function o

14 Monte Carlo Because of their reliance on repeated computation of random or pseudo-random numbers, Monte Carlo methods are most suited to calculation by a computer. Monte Carlo methods tend to be used when it is unfeasible or impossible to compute an exact result with a deterministic algorithm Or when you are too stupid to do the math yourself?

15 Monte Carlo (Minimization) dE<0dE>0

16 Gibbs sampler. Monte Carlo simulations RFFGGDRGAPKRG YLDPLIRGLLARPAKLQV KPGQPPRLLIYDASNRATGIPA GSLFVYNITTNKYKAFLDKQ SALLSSDITASVNCAK GFKGEQGPKGEP DVFKELKVHHANENI SRYWAIRTRSGGI TYSTNEIDLQLSQEDGQTIE RFFGGDRGAPKRG YLDPLIRGLLARPAKLQV KPGQPPRLLIYDASNRATGIPA GSLFVYNITTNKYKAFLDKQ SALLSSDITASVNCAK GFKGEQGPKGEP DVFKELKVHHANENI SRYWAIRTRSGGI TYSTNEIDLQLSQEDGQTIE E1 = 5.4 E2 = 5.7 E2 = 5.2 dE>0; P accept =1 dE<0; 0 < P accept < 1 Note the sign. Maximization

17 Monte Carlo Temperature What is the Monte Carlo temperature? Say dE=-0.2, T=1 T=0.001

18 MC minimization

19 Monte Carlo - Examples Why a temperature?

20 Local minima

21 A prediction method contains a very large set of parameters –A matrix for predicting binding for 9meric peptides has 9x20=180 weights Over fitting is a problem Data driven method training years Temperature

22 ALAKAAAAM ALAKAAAAN ALAKAAAAR ALAKAAAAT ALAKAAAAV GMNERPILT GILGFVFTM TLNAWVKVV KLNEPVLLL AVVPFIVSV MRSGRVHAV VRFNIDETP ANYIGQDGL AELCGDPGD QTRAVADGK GRPVPAAHP MTAQWWLDA FARGVVHVI LQRELTRLQ AVAEEMTKS Evaluation of predictive performance Train PSSM on raw data – No pseudo counts, No sequence weighting – Fit 9*20 parameters to 9*10 data points Evaluate on training data –PCC = 0.97 –AUC = 1.0 Close to a perfect prediction method Binders None Binders

23 AAAMAAKLA AAKNLAAAA AKALAAAAR AAAAKLATA ALAKAVAAA IPELMRTNG FIMGVFTGL NVTKVVAWL LEPLNLVLK VAVIVSVPF MRSGRVHAV VRFNIDETP ANYIGQDGL AELCGDPGD QTRAVADGK GRPVPAAHP MTAQWWLDA FARGVVHVI LQRELTRLQ AVAEEMTKS Evaluation of predictive performance Train PSSM on Permuted (random) data – No pseudo counts, No sequence weighting – Fit 9*20 parameters to 9*10 data points Evaluate on training data –PCC = 0.97 –AUC = 1.0 Close to a perfect prediction method AND Same performance as one the original data Binders None Binders

24 Repeat on large training data (229 ligands)

25 Cross validation Train on 4/5 of data Test/evaluate on 1/5 => Produce 5 different methods each with a different prediction focus

26 Model over-fitting 2000 MHC:peptide binding data PCC=0.99 Evaluate on 600 MHC:peptide binding data PCC=0.80

27 Model over-fitting (early stopping) Evaluate on 600 MHC:peptide binding data PCC=0.89 Stop training

28 What is going on? years Temperature  

29 5 fold training Which method to choose?

30 5 fold training

31 Method evaluation Use cross validation Evaluate on concatenated data and not as an average over each cross-validated performance

32 Method evaluation Which prediction to use?

33 Method evaluation

34 SMM - Stabilization matrix method I1I1 I2I2 w1w1 w2w2 Linear function o Per target: Global: Sum over weights Sum over data points

35 SMM - Stabilization matrix method I1I1 I2I2 w1w1 w2w2 Linear function o per target

36 SMM - Stabilization matrix method I1I1 I2I2 w1w1 w2w2 Linear function o

37 SMM training Evaluate on 600 MHC:peptide binding data L=0: PCC=0.70 L=0.1 PCC = 0.78

38 SMM - Stabilization matrix method Monte Carlo I1I1 I2I2 w1w1 w2w2 Linear function o Global: Make random change to weights Calculate change in “global” error Update weights if MC move is accepted Note difference between MC and GD in the use of “global” versus “per target” error

39 Training/evaluation procedure Define method Select data Deal with data redundancy –In method (sequence weighting) –In data (Hobohm) Deal with over-fitting either –in method (SMM regulation term) or –in training (stop fitting on test set performance) Evaluate method using cross-validation

40 A small doit script /usr/opt/www/pub/CBS/courses/27623.algo/exercises/code/SMM/doit_ex #! /bin/tcsh foreach a ( `cat allelefile` ) mkdir -p $ cd $a foreach l ( 0 1 2.5 5 10 20 30 ) mkdir -p l.$l cd l.$l foreach n ( 0 1 2 3 4 ) smm -nc 500 -l $l train.$n > mat.$n pep2score -mat mat.$n eval.$n > eval.$n.pred end echo $a $l `cat eval.?.pred | grep -v "#" | gawk '{print $2,$3}' | xycorr` cd.. end cd.. end


Download ppt "Optimization methods Morten Nielsen Department of Systems Biology, DTU."

Similar presentations


Ads by Google