REUMass Amherst 2015 Data Science Bootcampmarlin/teaching/REU/bootcamp-day3.pdf · REUMass Amherst...

36
REUMass Amherst 2015 Data Science Bootcamp Day 3: Classification, Regression, and Model Selection Prof. Ben Marlin [email protected]

Transcript of REUMass Amherst 2015 Data Science Bootcampmarlin/teaching/REU/bootcamp-day3.pdf · REUMass Amherst...

 

REUMass Amherst 2015 Data Science Bootcamp

Day 3: Classification, Regression,

and Model Selection  

Prof. Ben Marlin [email protected]

 

 

Plan  for  Day  3:    • More  on  Classifica4on  •  Introduc4on  to  Regression  • Model  Selec4on  and  Hyperparameters  

 

Classifica4on  

 

Classifier  Performance  

 

K  Nearest  Neighbors  

•  Need  to  pick  number  of  neighbors  K.  

•  Need  to  define  a  distance  func8on.  

 

x2   Data  

x1  

x1<4  

0  1  2  3  4  5  6  7  

0  1

 2  3

 4  5

 6  

Decision  Trees  

 

x2   Data  

x1  

x1<4  

x2<2  

Y  

0  1  2  3  4  5  6  7  

0  1

 2  3

 4  5

 6  

Decision  Trees  

 

x2   Data  

x1  

x1<4  

x2<2  

Y  

Y   N  

0  1  2  3  4  5  6  7  

0  1

 2  3

 4  5

 6  

Decision  Trees  

 

x2   Data  

x1  

x1<4  

x2<2   x1<6  

Y  

Y   N  

N  

0  1  2  3  4  5  6  7  

0  1

 2  3

 4  5

 6  

Decision  Trees  

 

x2   Data  

x1  

x1<4  

x2<2   x1<6  

Y  

Y   N  

N  

Y   N  

0  1  2  3  4  5  6  7  

0  1

 2  3

 4  5

 6  

Decision  Trees  

 

x1<4  

x2<2   x1<6  

Y  

Y   N  

N  

Y   N  

Decision  Trees  

•  Need  to  choose  the  maximum  depth  of  the  tree.  

•  Need  to  choose  a  spliFng  criterion.  

 

Linear  Classifiers  

 

Linear  Classifiers  

 

Linear  Classifiers  

 

Linear  Classifiers  

 

Non-­‐Linear  SVMs  and  Basis  Expansion  

i  

 

Non-­‐Linear  SVMs  and  Kernels  i  

 

Regression  

 

 

Example:  Stock  Prices  

 

Example:  Climate  Data  

 

Example:  Weather  

 

The  Regression  Learning  Problem  

 

KNN  Regression  

 

KNN  Regression  (K=1  vs  K=9)  

 

KNN  Regression  (K=1  vs  K=9)  

 

Linear  Regression  

 

Learning  Linear  Regression  Models  

 

Linear  Regression  

 

Non-­‐Linear  Regression  With  Kernels    

 

Model  Selec4on  &  Hyperparameters  

 

Hyperparameter  and  Model  Selec4on:    

•  All  of  the  models  we’ve  seen  have  some  free  parameters  (called  hyperparameters)  that  need  to  be  chosen.  

•  Think  of  the  K  in  KNN,  the  depth  of  a  decision  tree,  the  kernel  and  regulariza8on  parameter  in  an  SVM.  

•  The    most  common  methods  for  choosing  hyperparameters  in  machine  learning  are  valida8on  set  methods.    

 

Train  

Valida8on  

Test  

Data  Cases  

Features  

Train  models  

Pick  Best  Model  

Evaluate  Best  Model  

 

B3  

B2  

B1  

Train  

Val  

Learn  

Test  

Data  Cases  

Features  

 

B3  

B2  

B1  

Train  

Val  

Data  Cases  

Features  

Learn  

Test  

 

B3  

B2  

B1  Train  

Val  Data  Cases  

Features  

Learn  

Test