SlideShare a Scribd company logo
1 of 27
Download to read offline
Lecture 7: Tuning hyperparameters using cross validation
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
April 4, 2014
Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
logofC
1.5 2 2.5 3 3.5 4 4.5
1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
Motivation: the influence of C on SVM
0 0.5 1 1.5 2 2.5 3 3.5 4
0.22
0.24
0.26
0.28
0.3error
C (log. scale)
0
0
1
−1
C too small
0
0
0
1
1
1
−1−1
−1
−1
−1
nice C
0
0
0
0
0
1
1
1
1
1
1
−1
−1
−1
−1
−1
C too large
Motivation:
Need for model selection (tuning the hyper parameters)
Require a good estimation of the performance on future data Choose a
relevant performance measure
Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
logofC
1.5 2 2.5 3 3.5 4 4.5
1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
Machine learning without data
minimizing IP(error)
Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
logofC
1.5 2 2.5 3 3.5 4 4.5
1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
Training and test data
Split dataset into two groups randomly picked (hold out strategy)
Training set: used to train the classifier
Test set: used to estimate the error rate of the trained classifier
(X,y) total available data
(Xa,ya) training data (Xt,yt) test data
(Xa, ya, Xt, yt) ← split(X, y, option = 1
3 )
Generally, the larger the training data the better the classifier
The larger the test data the more accurate the error estimate
Assessing the quality of a trained SVM: minimum error rate
Definition (The confusion matrix)
A matrix showing the predicted and actual classifications. A confusion
matrix is of size L × L, where L is the number of different classes.
Observed / predicted Positive Negative
positive a b
negative c d
Error rate = 1 - Accuracy =
b + c
a + b + c + d
=
b + c
n
= 1 −
a + d
n
True positive rate (Recall, Sensitivity) d/(c+d).
True negative rate (Specificity) a/(a+b).
Precision, False positive rate, False negative rate...
Other performances measures
N. Japkowicz & M. Shah, "Evaluating Learning Algorithms: A Classification Perspective", Cambridge University Press, 2011
The learning equation
Learning = training + testing + tuning
Table: my experimental error rates
State of the art my new method Bayes error
problem 1 10% ± 1.25 8.5% ± .5
problem 2 5 % (.25) 4 % (.5)
is my new method good for problem 1?
The learning equation
Learning = training + testing + tuning
Table: my experimental error rates
State of the art my new method Bayes error
problem 1 10% ± 1.25 8.5% ± .5 11 %
problem 2 5 % (.25) 4 % (.5) 2 %
is my new method good for problem 1?
Error bars on Bernouilli trials
Error rate = p B(p)
with confidence α: (Normal approximation interval)
p = IP(error) in p ± u1−α/2
p (1 − p)
nt
with confidence α: (improved approximation)
p = IP(error) in
1
1 + 1
K u2
1−α/2

p ± u1−α/2
p (1 − p)
nt


what if p = 0?
http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval
To improve the estimate
Random Subsampling (The repeated holdout method)
K-Fold Cross-Validation (K = 10 or K = 2 or k = n)
Leave-one-out Cross-Validation (k = 1)
Bootstrap
Error bars: the gaussian approximation
... and to stabilize: iterate K times - do it say K = 10 times
The repeated holdout method
Holdout estimate can be made more reliable by repeating the process
with different subsamples
In each iteration, use a different random splitting
Average the error rates on the different iterations
mean error rate e =
1
K
K
k=1
ek variance σ2
=
1
K − 1
K
k=1
(ek − e)2
.
e + tα/2,K−1
σ2
K
t0.025,9 = 2.262
Cross validation
Definition (Cross-validation)
A method for estimating the accuracy of an inducer by dividing the data
into K mutually exclusive subsets (the “folds”) of approximately equal size.
Exemple of K = 3-Fold Cross-Validation
training data
test data
How many folds are needed (K =?)
large: small bias, large variance as well as computational time
small: computation time reduced, small variance, large bias
A common choice for K-Fold Cross Validation is K=5
Leave one out cross validation
Theoretical guarantees
The bootstrap
Comparing results
Two different issues
what is the best method for my problem?
how good is my learning algorithm?
Comparing two algorithms: Mc Nemar’s test
build the confusion matrix of the two algorithms
Algo 1 / Algo 2 right wrong
right number of examples well
classified by both
e01 number of examples
well classified by 1 but not
by 2
wrong e10 number of examples
missclassified by 1 but not
by 2
number of examples miss-
classified by both
H0: if the two algorithms are the same (we expect e10 = e01 = e10+e01
2 )
(|e10 − e01| − 1)2
e10 + e01
∼ χ2
1
Beware: if e10 + e01 < 20 better use the sign test
Matlab function:
http://www.mathworks.com/matlabcentral/fileexchange/189-discrim/content/discrim/
mcnemar.m
J. L. Fleiss (1981) Statistical Methods for Rates and Proportions. Second Edition. Wiley.
Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
logofC
1.5 2 2.5 3 3.5 4 4.5
1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
Model selection strategy
Model selection criteria attempt to find a good compromise between
The complexity of a model
Its prediction accuracy on the training data
1 (Xa, ya, Xt, yt) ← split(X, y, options)
2 (C, b) ← tune(Xa, ya, options)
3 model ← train(Xa, ya, C, b, options)
4 error ← test(Xt, yt, C, b, options)
Occam’s Razor:
the best theory is the smallest one that describes all the facts
Model selection: the tuning function
function (C, b) ← tune(Xa, ya, options)
1 (X , y , Xv, yv) ← split(Xa, ya, options)
2 loop on a grid for C
3 loop on a grid for b
1 model ← train(X , y , C, b, options)
2 error ← test(Xv, yv, C, b, options)
The three sets
Training set: a set of examples used for learning: to fit the parameters
Validation set: a set of examples used to tune the hyper parameters
Test set: independent instances that have played no part in formation
of classifier
how to design the grids
A grid on b
A much simpler trick is to pick, say 1000 pairs (x,x’) at random from your
dataset, compute the distance of all such pairs and take the median, the
0.1 and the 0.9 quantile. Now pick b to be the inverse any of these three
numbers.
http://blog.smola.org/post/940859888/easy-kernel-width-choice
A grid on C
from Cmin to ∞
to much!
The coarse to fine strategy
1 use a large coarse grid on a few data to localize interesting values
2 fine tuning on all data in this zone
1 (Xa, ya, Xt, yt) ← split(X, y)
2 (C, b) ← tune(Xa, ya, coarsegrids, smalltrainingset)
3 finegrids ← fit_grid(C, b)
4 (C, b) ← tune(Xa, ya, finegrids, largetrainingset)
5 model ← train(Xa, ya, C, b, options)
6 error ← test(Xt, yt, C, b, options)
The computing time is the key issue
Evaluation measures
the span bound
Bibliography
http://research.cs.tamu.edu/prism/lectures/iss/iss_l13.pdf
http://www.cs.odu.edu/~mukka/cs795sum13dm/Lecturenotes/Day3/Chapter5.pdf
http://www.cs.cmu.edu/~epxing/Class/10701-10s/Lecture/lecture8.pdf
http://www.mohakshah.com/tutorials/icml2012/Tutorial-ICML2012/Tutorial_at_ICML_
2012_files/ICML2012-Tutorial.pdf
Stéphane Canu (INSA Rouen - LITIS) April 4, 2014 26 / 26

More Related Content

What's hot

PEMF-1-MAO2012-Ali
PEMF-1-MAO2012-AliPEMF-1-MAO2012-Ali
PEMF-1-MAO2012-AliMDO_Lab
 
Cross-validation Tutorial: What, how and which?
Cross-validation Tutorial: What, how and which?Cross-validation Tutorial: What, how and which?
Cross-validation Tutorial: What, how and which?Pradeep Redddy Raamana
 
Data Analysis project "TITANIC SURVIVAL"
Data Analysis project "TITANIC SURVIVAL"Data Analysis project "TITANIC SURVIVAL"
Data Analysis project "TITANIC SURVIVAL"LefterisMitsimponas
 
WEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedWEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedDataminingTools Inc
 
AIAA-Aviation-2015-Mehmani
AIAA-Aviation-2015-MehmaniAIAA-Aviation-2015-Mehmani
AIAA-Aviation-2015-MehmaniOptiModel
 
ModelSelection1_WCSMO_2013_Ali
ModelSelection1_WCSMO_2013_AliModelSelection1_WCSMO_2013_Ali
ModelSelection1_WCSMO_2013_AliMDO_Lab
 
Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1) Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1) Marina Santini
 
DSUS_MAO_2012_Jie
DSUS_MAO_2012_JieDSUS_MAO_2012_Jie
DSUS_MAO_2012_JieMDO_Lab
 
An introduction to variable and feature selection
An introduction to variable and feature selectionAn introduction to variable and feature selection
An introduction to variable and feature selectionMarco Meoni
 
Machine Learning - Splitting Datasets
Machine Learning - Splitting DatasetsMachine Learning - Splitting Datasets
Machine Learning - Splitting DatasetsAndrew Ferlitsch
 
MLlectureMethod.ppt
MLlectureMethod.pptMLlectureMethod.ppt
MLlectureMethod.pptbutest
 
AIAA-SciTech-ModelSelection-2014-Mehmani
AIAA-SciTech-ModelSelection-2014-MehmaniAIAA-SciTech-ModelSelection-2014-Mehmani
AIAA-SciTech-ModelSelection-2014-MehmaniOptiModel
 
AMS_Aviation_2014_Ali
AMS_Aviation_2014_AliAMS_Aviation_2014_Ali
AMS_Aviation_2014_AliMDO_Lab
 
PEMF2_SDM_2012_Ali
PEMF2_SDM_2012_AliPEMF2_SDM_2012_Ali
PEMF2_SDM_2012_AliMDO_Lab
 

What's hot (16)

Dbm630 lecture08
Dbm630 lecture08Dbm630 lecture08
Dbm630 lecture08
 
PEMF-1-MAO2012-Ali
PEMF-1-MAO2012-AliPEMF-1-MAO2012-Ali
PEMF-1-MAO2012-Ali
 
Cross-validation Tutorial: What, how and which?
Cross-validation Tutorial: What, how and which?Cross-validation Tutorial: What, how and which?
Cross-validation Tutorial: What, how and which?
 
Data Analysis project "TITANIC SURVIVAL"
Data Analysis project "TITANIC SURVIVAL"Data Analysis project "TITANIC SURVIVAL"
Data Analysis project "TITANIC SURVIVAL"
 
Model selection
Model selectionModel selection
Model selection
 
WEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedWEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been Learned
 
AIAA-Aviation-2015-Mehmani
AIAA-Aviation-2015-MehmaniAIAA-Aviation-2015-Mehmani
AIAA-Aviation-2015-Mehmani
 
ModelSelection1_WCSMO_2013_Ali
ModelSelection1_WCSMO_2013_AliModelSelection1_WCSMO_2013_Ali
ModelSelection1_WCSMO_2013_Ali
 
Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1) Lecture 8: Machine Learning in Practice (1)
Lecture 8: Machine Learning in Practice (1)
 
DSUS_MAO_2012_Jie
DSUS_MAO_2012_JieDSUS_MAO_2012_Jie
DSUS_MAO_2012_Jie
 
An introduction to variable and feature selection
An introduction to variable and feature selectionAn introduction to variable and feature selection
An introduction to variable and feature selection
 
Machine Learning - Splitting Datasets
Machine Learning - Splitting DatasetsMachine Learning - Splitting Datasets
Machine Learning - Splitting Datasets
 
MLlectureMethod.ppt
MLlectureMethod.pptMLlectureMethod.ppt
MLlectureMethod.ppt
 
AIAA-SciTech-ModelSelection-2014-Mehmani
AIAA-SciTech-ModelSelection-2014-MehmaniAIAA-SciTech-ModelSelection-2014-Mehmani
AIAA-SciTech-ModelSelection-2014-Mehmani
 
AMS_Aviation_2014_Ali
AMS_Aviation_2014_AliAMS_Aviation_2014_Ali
AMS_Aviation_2014_Ali
 
PEMF2_SDM_2012_Ali
PEMF2_SDM_2012_AliPEMF2_SDM_2012_Ali
PEMF2_SDM_2012_Ali
 

Viewers also liked

Lecture 2 Basic Concepts in Machine Learning for Language Technology
Lecture 2 Basic Concepts in Machine Learning for Language TechnologyLecture 2 Basic Concepts in Machine Learning for Language Technology
Lecture 2 Basic Concepts in Machine Learning for Language TechnologyMarina Santini
 
An Approach For Single Object Detection In Images
An Approach For Single Object Detection In ImagesAn Approach For Single Object Detection In Images
An Approach For Single Object Detection In ImagesCSCJournals
 
Ensemble Learning Featuring the Netflix Prize Competition and ...
Ensemble Learning Featuring the Netflix Prize Competition and ...Ensemble Learning Featuring the Netflix Prize Competition and ...
Ensemble Learning Featuring the Netflix Prize Competition and ...butest
 
Gender Differences on Interacting Effects of Marriage & Health Insurance on C...
Gender Differences on Interacting Effects of Marriage & Health Insurance on C...Gender Differences on Interacting Effects of Marriage & Health Insurance on C...
Gender Differences on Interacting Effects of Marriage & Health Insurance on C...Cross-Validation & Knowledge Translation
 
ensemble learning
ensemble learningensemble learning
ensemble learningbutest
 
Buscadores especializados para docentes ad sjuliol 2013
Buscadores especializados para docentes  ad sjuliol 2013Buscadores especializados para docentes  ad sjuliol 2013
Buscadores especializados para docentes ad sjuliol 2013TICS & Partners
 
Introduction to Data Mining / Bioinformatics
Introduction to Data Mining / BioinformaticsIntroduction to Data Mining / Bioinformatics
Introduction to Data Mining / BioinformaticsGerald Lushington
 
「これからの強化学習」勉強会#2
「これからの強化学習」勉強会#2「これからの強化学習」勉強会#2
「これからの強化学習」勉強会#2Chihiro Kusunoki
 
コピュラと金融工学の新展開(?)
コピュラと金融工学の新展開(?)コピュラと金融工学の新展開(?)
コピュラと金融工学の新展開(?)Nagi Teramo
 
Rで学ぶ『構造型モデル de 倒産確率推定』
Rで学ぶ『構造型モデル de 倒産確率推定』Rで学ぶ『構造型モデル de 倒産確率推定』
Rで学ぶ『構造型モデル de 倒産確率推定』Nagi Teramo
 
Information-Theoretic Metric Learning
Information-Theoretic Metric LearningInformation-Theoretic Metric Learning
Information-Theoretic Metric LearningKoji Matsuda
 
Analytical method validation
Analytical method validationAnalytical method validation
Analytical method validationGaurav Kr
 
analytical method validation
analytical method validationanalytical method validation
analytical method validationDr. Raja Abhilash
 
Analytical Method Validation
Analytical Method ValidationAnalytical Method Validation
Analytical Method ValidationStefan Holt
 
ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR
ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR
ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR Dr. Ravi Sankar
 

Viewers also liked (19)

Cross-Validation
Cross-ValidationCross-Validation
Cross-Validation
 
Lecture 2 Basic Concepts in Machine Learning for Language Technology
Lecture 2 Basic Concepts in Machine Learning for Language TechnologyLecture 2 Basic Concepts in Machine Learning for Language Technology
Lecture 2 Basic Concepts in Machine Learning for Language Technology
 
An Approach For Single Object Detection In Images
An Approach For Single Object Detection In ImagesAn Approach For Single Object Detection In Images
An Approach For Single Object Detection In Images
 
Ensemble Learning Featuring the Netflix Prize Competition and ...
Ensemble Learning Featuring the Netflix Prize Competition and ...Ensemble Learning Featuring the Netflix Prize Competition and ...
Ensemble Learning Featuring the Netflix Prize Competition and ...
 
Machine learning group computer science department ULB - Lab'InSight Artifici...
Machine learning group computer science department ULB - Lab'InSight Artifici...Machine learning group computer science department ULB - Lab'InSight Artifici...
Machine learning group computer science department ULB - Lab'InSight Artifici...
 
Social Epidemiologic Methods in International Population Health
Social Epidemiologic Methods in International Population HealthSocial Epidemiologic Methods in International Population Health
Social Epidemiologic Methods in International Population Health
 
Gender Differences on Interacting Effects of Marriage & Health Insurance on C...
Gender Differences on Interacting Effects of Marriage & Health Insurance on C...Gender Differences on Interacting Effects of Marriage & Health Insurance on C...
Gender Differences on Interacting Effects of Marriage & Health Insurance on C...
 
ensemble learning
ensemble learningensemble learning
ensemble learning
 
Buscadores especializados para docentes ad sjuliol 2013
Buscadores especializados para docentes  ad sjuliol 2013Buscadores especializados para docentes  ad sjuliol 2013
Buscadores especializados para docentes ad sjuliol 2013
 
Introduction to Data Mining / Bioinformatics
Introduction to Data Mining / BioinformaticsIntroduction to Data Mining / Bioinformatics
Introduction to Data Mining / Bioinformatics
 
「これからの強化学習」勉強会#2
「これからの強化学習」勉強会#2「これからの強化学習」勉強会#2
「これからの強化学習」勉強会#2
 
コピュラと金融工学の新展開(?)
コピュラと金融工学の新展開(?)コピュラと金融工学の新展開(?)
コピュラと金融工学の新展開(?)
 
Rで学ぶ『構造型モデル de 倒産確率推定』
Rで学ぶ『構造型モデル de 倒産確率推定』Rで学ぶ『構造型モデル de 倒産確率推定』
Rで学ぶ『構造型モデル de 倒産確率推定』
 
Information-Theoretic Metric Learning
Information-Theoretic Metric LearningInformation-Theoretic Metric Learning
Information-Theoretic Metric Learning
 
Resampling methods
Resampling methodsResampling methods
Resampling methods
 
Analytical method validation
Analytical method validationAnalytical method validation
Analytical method validation
 
analytical method validation
analytical method validationanalytical method validation
analytical method validation
 
Analytical Method Validation
Analytical Method ValidationAnalytical Method Validation
Analytical Method Validation
 
ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR
ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR
ANALYTICAL METHOD VALIDATION BY P.RAVISANKAR
 

Similar to Lecture7 cross validation

Analytical study of feature extraction techniques in opinion mining
Analytical study of feature extraction techniques in opinion miningAnalytical study of feature extraction techniques in opinion mining
Analytical study of feature extraction techniques in opinion miningcsandit
 
ANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MINING
ANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MININGANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MINING
ANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MININGcsandit
 
Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...
Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...
Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...cscpconf
 
2.8 accuracy and ensemble methods
2.8 accuracy and ensemble methods2.8 accuracy and ensemble methods
2.8 accuracy and ensemble methodsKrish_ver2
 
Machine learning (5)
Machine learning (5)Machine learning (5)
Machine learning (5)NYversity
 
Machine Learning Algorithms Review(Part 2)
Machine Learning Algorithms Review(Part 2)Machine Learning Algorithms Review(Part 2)
Machine Learning Algorithms Review(Part 2)Zihui Li
 
13ClassifierPerformance.pdf
13ClassifierPerformance.pdf13ClassifierPerformance.pdf
13ClassifierPerformance.pdfssuserdce5c21
 
Data-Driven Recommender Systems
Data-Driven Recommender SystemsData-Driven Recommender Systems
Data-Driven Recommender Systemsrecsysfr
 
Model Selection and Validation
Model Selection and ValidationModel Selection and Validation
Model Selection and Validationgmorishita
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习AdaboostShocky1
 
L1 intro2 supervised_learning
L1 intro2 supervised_learningL1 intro2 supervised_learning
L1 intro2 supervised_learningYogendra Singh
 
A Multi-Objective Genetic Algorithm for Pruning Support Vector Machines
A Multi-Objective Genetic Algorithm for Pruning Support Vector MachinesA Multi-Objective Genetic Algorithm for Pruning Support Vector Machines
A Multi-Objective Genetic Algorithm for Pruning Support Vector MachinesMohamed Farouk
 
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifierAnomaly detection using deep one class classifier
Anomaly detection using deep one class classifier홍배 김
 
Two methods for optimising cognitive model parameters
Two methods for optimising cognitive model parametersTwo methods for optimising cognitive model parameters
Two methods for optimising cognitive model parametersUniversity of Huddersfield
 
Huong dan cu the svm
Huong dan cu the svmHuong dan cu the svm
Huong dan cu the svmtaikhoan262
 
Jörg Stelzer
Jörg StelzerJörg Stelzer
Jörg Stelzerbutest
 
Image Classification And Support Vector Machine
Image Classification And Support Vector MachineImage Classification And Support Vector Machine
Image Classification And Support Vector MachineShao-Chuan Wang
 
Learning On The Border:Active Learning in Imbalanced classification Data
Learning On The Border:Active Learning in Imbalanced classification DataLearning On The Border:Active Learning in Imbalanced classification Data
Learning On The Border:Active Learning in Imbalanced classification Data萍華 楊
 

Similar to Lecture7 cross validation (20)

Analytical study of feature extraction techniques in opinion mining
Analytical study of feature extraction techniques in opinion miningAnalytical study of feature extraction techniques in opinion mining
Analytical study of feature extraction techniques in opinion mining
 
ANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MINING
ANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MININGANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MINING
ANALYTICAL STUDY OF FEATURE EXTRACTION TECHNIQUES IN OPINION MINING
 
Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...
Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...
Radial Basis Function Neural Network (RBFNN), Induction Motor, Vector control...
 
2.8 accuracy and ensemble methods
2.8 accuracy and ensemble methods2.8 accuracy and ensemble methods
2.8 accuracy and ensemble methods
 
Machine learning (5)
Machine learning (5)Machine learning (5)
Machine learning (5)
 
Machine Learning Algorithms Review(Part 2)
Machine Learning Algorithms Review(Part 2)Machine Learning Algorithms Review(Part 2)
Machine Learning Algorithms Review(Part 2)
 
13ClassifierPerformance.pdf
13ClassifierPerformance.pdf13ClassifierPerformance.pdf
13ClassifierPerformance.pdf
 
Data-Driven Recommender Systems
Data-Driven Recommender SystemsData-Driven Recommender Systems
Data-Driven Recommender Systems
 
Model Selection and Validation
Model Selection and ValidationModel Selection and Validation
Model Selection and Validation
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习Adaboost
 
L1 intro2 supervised_learning
L1 intro2 supervised_learningL1 intro2 supervised_learning
L1 intro2 supervised_learning
 
A Multi-Objective Genetic Algorithm for Pruning Support Vector Machines
A Multi-Objective Genetic Algorithm for Pruning Support Vector MachinesA Multi-Objective Genetic Algorithm for Pruning Support Vector Machines
A Multi-Objective Genetic Algorithm for Pruning Support Vector Machines
 
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifierAnomaly detection using deep one class classifier
Anomaly detection using deep one class classifier
 
Two methods for optimising cognitive model parameters
Two methods for optimising cognitive model parametersTwo methods for optimising cognitive model parameters
Two methods for optimising cognitive model parameters
 
Guide
GuideGuide
Guide
 
Huong dan cu the svm
Huong dan cu the svmHuong dan cu the svm
Huong dan cu the svm
 
Jörg Stelzer
Jörg StelzerJörg Stelzer
Jörg Stelzer
 
Image Classification And Support Vector Machine
Image Classification And Support Vector MachineImage Classification And Support Vector Machine
Image Classification And Support Vector Machine
 
Guide
GuideGuide
Guide
 
Learning On The Border:Active Learning in Imbalanced classification Data
Learning On The Border:Active Learning in Imbalanced classification DataLearning On The Border:Active Learning in Imbalanced classification Data
Learning On The Border:Active Learning in Imbalanced classification Data
 

More from Stéphane Canu

Lecture 2: linear SVM in the Dual
Lecture 2: linear SVM in the DualLecture 2: linear SVM in the Dual
Lecture 2: linear SVM in the DualStéphane Canu
 
Lecture10 outilier l0_svdd
Lecture10 outilier l0_svddLecture10 outilier l0_svdd
Lecture10 outilier l0_svddStéphane Canu
 
Lecture8 multi class_svm
Lecture8 multi class_svmLecture8 multi class_svm
Lecture8 multi class_svmStéphane Canu
 
Lecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhsLecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhsStéphane Canu
 
Lecture3 linear svm_with_slack
Lecture3 linear svm_with_slackLecture3 linear svm_with_slack
Lecture3 linear svm_with_slackStéphane Canu
 
Lecture 2: linear SVM in the dual
Lecture 2: linear SVM in the dualLecture 2: linear SVM in the dual
Lecture 2: linear SVM in the dualStéphane Canu
 
Lecture 1: linear SVM in the primal
Lecture 1: linear SVM in the primalLecture 1: linear SVM in the primal
Lecture 1: linear SVM in the primalStéphane Canu
 
Lecture9 multi kernel_svm
Lecture9 multi kernel_svmLecture9 multi kernel_svm
Lecture9 multi kernel_svmStéphane Canu
 
Main recsys factorisation
Main recsys factorisationMain recsys factorisation
Main recsys factorisationStéphane Canu
 

More from Stéphane Canu (11)

Lecture 2: linear SVM in the Dual
Lecture 2: linear SVM in the DualLecture 2: linear SVM in the Dual
Lecture 2: linear SVM in the Dual
 
Lecture10 outilier l0_svdd
Lecture10 outilier l0_svddLecture10 outilier l0_svdd
Lecture10 outilier l0_svdd
 
Lecture8 multi class_svm
Lecture8 multi class_svmLecture8 multi class_svm
Lecture8 multi class_svm
 
Lecture6 svdd
Lecture6 svddLecture6 svdd
Lecture6 svdd
 
Lecture5 kernel svm
Lecture5 kernel svmLecture5 kernel svm
Lecture5 kernel svm
 
Lecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhsLecture4 kenrels functions_rkhs
Lecture4 kenrels functions_rkhs
 
Lecture3 linear svm_with_slack
Lecture3 linear svm_with_slackLecture3 linear svm_with_slack
Lecture3 linear svm_with_slack
 
Lecture 2: linear SVM in the dual
Lecture 2: linear SVM in the dualLecture 2: linear SVM in the dual
Lecture 2: linear SVM in the dual
 
Lecture 1: linear SVM in the primal
Lecture 1: linear SVM in the primalLecture 1: linear SVM in the primal
Lecture 1: linear SVM in the primal
 
Lecture9 multi kernel_svm
Lecture9 multi kernel_svmLecture9 multi kernel_svm
Lecture9 multi kernel_svm
 
Main recsys factorisation
Main recsys factorisationMain recsys factorisation
Main recsys factorisation
 

Recently uploaded

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

Recently uploaded (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Lecture7 cross validation

  • 1. Lecture 7: Tuning hyperparameters using cross validation Stéphane Canu stephane.canu@litislab.eu Sao Paulo 2014 April 4, 2014
  • 2. Roadmap 1 Tuning hyperparameters Motivation Machine learning without data Assessing the quality of a trained SVM Model selection log of the bandwith logofC 1.5 2 2.5 3 3.5 4 4.5 1 0 1 2 3 4 “Evaluation is the key to making real progress in data mining”, [Witten & Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
  • 3. Motivation: the influence of C on SVM 0 0.5 1 1.5 2 2.5 3 3.5 4 0.22 0.24 0.26 0.28 0.3error C (log. scale) 0 0 1 −1 C too small 0 0 0 1 1 1 −1−1 −1 −1 −1 nice C 0 0 0 0 0 1 1 1 1 1 1 −1 −1 −1 −1 −1 C too large
  • 4. Motivation: Need for model selection (tuning the hyper parameters) Require a good estimation of the performance on future data Choose a relevant performance measure
  • 5. Roadmap 1 Tuning hyperparameters Motivation Machine learning without data Assessing the quality of a trained SVM Model selection log of the bandwith logofC 1.5 2 2.5 3 3.5 4 4.5 1 0 1 2 3 4 “Evaluation is the key to making real progress in data mining”, [Witten & Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
  • 6. Machine learning without data minimizing IP(error)
  • 7. Roadmap 1 Tuning hyperparameters Motivation Machine learning without data Assessing the quality of a trained SVM Model selection log of the bandwith logofC 1.5 2 2.5 3 3.5 4 4.5 1 0 1 2 3 4 “Evaluation is the key to making real progress in data mining”, [Witten & Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
  • 8. Training and test data Split dataset into two groups randomly picked (hold out strategy) Training set: used to train the classifier Test set: used to estimate the error rate of the trained classifier (X,y) total available data (Xa,ya) training data (Xt,yt) test data (Xa, ya, Xt, yt) ← split(X, y, option = 1 3 ) Generally, the larger the training data the better the classifier The larger the test data the more accurate the error estimate
  • 9. Assessing the quality of a trained SVM: minimum error rate Definition (The confusion matrix) A matrix showing the predicted and actual classifications. A confusion matrix is of size L × L, where L is the number of different classes. Observed / predicted Positive Negative positive a b negative c d Error rate = 1 - Accuracy = b + c a + b + c + d = b + c n = 1 − a + d n True positive rate (Recall, Sensitivity) d/(c+d). True negative rate (Specificity) a/(a+b). Precision, False positive rate, False negative rate...
  • 10. Other performances measures N. Japkowicz & M. Shah, "Evaluating Learning Algorithms: A Classification Perspective", Cambridge University Press, 2011
  • 11. The learning equation Learning = training + testing + tuning Table: my experimental error rates State of the art my new method Bayes error problem 1 10% ± 1.25 8.5% ± .5 problem 2 5 % (.25) 4 % (.5) is my new method good for problem 1?
  • 12. The learning equation Learning = training + testing + tuning Table: my experimental error rates State of the art my new method Bayes error problem 1 10% ± 1.25 8.5% ± .5 11 % problem 2 5 % (.25) 4 % (.5) 2 % is my new method good for problem 1?
  • 13. Error bars on Bernouilli trials Error rate = p B(p) with confidence α: (Normal approximation interval) p = IP(error) in p ± u1−α/2 p (1 − p) nt with confidence α: (improved approximation) p = IP(error) in 1 1 + 1 K u2 1−α/2  p ± u1−α/2 p (1 − p) nt   what if p = 0? http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval
  • 14. To improve the estimate Random Subsampling (The repeated holdout method) K-Fold Cross-Validation (K = 10 or K = 2 or k = n) Leave-one-out Cross-Validation (k = 1) Bootstrap
  • 15. Error bars: the gaussian approximation ... and to stabilize: iterate K times - do it say K = 10 times The repeated holdout method Holdout estimate can be made more reliable by repeating the process with different subsamples In each iteration, use a different random splitting Average the error rates on the different iterations mean error rate e = 1 K K k=1 ek variance σ2 = 1 K − 1 K k=1 (ek − e)2 . e + tα/2,K−1 σ2 K t0.025,9 = 2.262
  • 16. Cross validation Definition (Cross-validation) A method for estimating the accuracy of an inducer by dividing the data into K mutually exclusive subsets (the “folds”) of approximately equal size. Exemple of K = 3-Fold Cross-Validation training data test data How many folds are needed (K =?) large: small bias, large variance as well as computational time small: computation time reduced, small variance, large bias A common choice for K-Fold Cross Validation is K=5
  • 17. Leave one out cross validation Theoretical guarantees
  • 19. Comparing results Two different issues what is the best method for my problem? how good is my learning algorithm?
  • 20. Comparing two algorithms: Mc Nemar’s test build the confusion matrix of the two algorithms Algo 1 / Algo 2 right wrong right number of examples well classified by both e01 number of examples well classified by 1 but not by 2 wrong e10 number of examples missclassified by 1 but not by 2 number of examples miss- classified by both H0: if the two algorithms are the same (we expect e10 = e01 = e10+e01 2 ) (|e10 − e01| − 1)2 e10 + e01 ∼ χ2 1 Beware: if e10 + e01 < 20 better use the sign test Matlab function: http://www.mathworks.com/matlabcentral/fileexchange/189-discrim/content/discrim/ mcnemar.m J. L. Fleiss (1981) Statistical Methods for Rates and Proportions. Second Edition. Wiley.
  • 21. Roadmap 1 Tuning hyperparameters Motivation Machine learning without data Assessing the quality of a trained SVM Model selection log of the bandwith logofC 1.5 2 2.5 3 3.5 4 4.5 1 0 1 2 3 4 “Evaluation is the key to making real progress in data mining”, [Witten & Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)
  • 22. Model selection strategy Model selection criteria attempt to find a good compromise between The complexity of a model Its prediction accuracy on the training data 1 (Xa, ya, Xt, yt) ← split(X, y, options) 2 (C, b) ← tune(Xa, ya, options) 3 model ← train(Xa, ya, C, b, options) 4 error ← test(Xt, yt, C, b, options) Occam’s Razor: the best theory is the smallest one that describes all the facts
  • 23. Model selection: the tuning function function (C, b) ← tune(Xa, ya, options) 1 (X , y , Xv, yv) ← split(Xa, ya, options) 2 loop on a grid for C 3 loop on a grid for b 1 model ← train(X , y , C, b, options) 2 error ← test(Xv, yv, C, b, options) The three sets Training set: a set of examples used for learning: to fit the parameters Validation set: a set of examples used to tune the hyper parameters Test set: independent instances that have played no part in formation of classifier
  • 24. how to design the grids A grid on b A much simpler trick is to pick, say 1000 pairs (x,x’) at random from your dataset, compute the distance of all such pairs and take the median, the 0.1 and the 0.9 quantile. Now pick b to be the inverse any of these three numbers. http://blog.smola.org/post/940859888/easy-kernel-width-choice A grid on C from Cmin to ∞ to much!
  • 25. The coarse to fine strategy 1 use a large coarse grid on a few data to localize interesting values 2 fine tuning on all data in this zone 1 (Xa, ya, Xt, yt) ← split(X, y) 2 (C, b) ← tune(Xa, ya, coarsegrids, smalltrainingset) 3 finegrids ← fit_grid(C, b) 4 (C, b) ← tune(Xa, ya, finegrids, largetrainingset) 5 model ← train(Xa, ya, C, b, options) 6 error ← test(Xt, yt, C, b, options) The computing time is the key issue