1 / 44

Spring 2009 New Mexico Tech

CSE489-02 & CSE589-02 Multimedia Processing Lecture 09 Pattern Classifier and Evaluation for Multimedia Applications. Spring 2009 New Mexico Tech. Basic Concepts and Definitions. Sensitivity — proportion of patients with disease who test positive P(T+|D+) = TP / (TP+FN). Specificity —

aelwen
Download Presentation

Spring 2009 New Mexico Tech

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE489-02 & CSE589-02 Multimedia ProcessingLecture 09 Pattern Classifier and Evaluation for Multimedia Applications Spring 2009 New Mexico Tech

  2. Basic Concepts and Definitions Sensitivity— proportion of patients with disease who test positive P(T+|D+) = TP / (TP+FN) Specificity— proportion of patients without disease who test negative P(T-|D-) = TN / (TN + FP)

  3. Sensitivity and Specificity Sensitivity: the ability to detect "true positives" TP TP + FN Accuracy (specificity): the ability to avoid "false positives" TN TN + FP Positive Predictive Value (PPV) TP TP + FP

  4. Accuracy • Definition: TP + TN TP + TN + FP + FN • Range: [0 … 1]

  5. Matthews correlation coefficient • Definition: TP·TN - FN·FP √(TN+FN)(TN+FP)(TP+FN)(TP+FP) • Range: [-1 … 1]

  6. An example: On a test set with 20 motif-containing (m+) and 47 motif-lacking (m-) proteins, the following results were obtained: predicted: m+ m- true : m+ 17 3 tp fn m- 8 39 fp tn sensitivity = tp/(tp+fn) = 17/(17+3)= 0.85 specificity = tp/(tp+fp) = 17/(17+8)= 0.68 MCC= ... = 0.64

  7. An Example: Hypothyroidism • Hypothyroidism is the disease state in humans and other animals caused by insufficient production of thyroid hormone by the thyroid gland. • Clinical Response to Thyroxine Sodium in Clinically Hypothyroid but Biochemically Euthyroid Patients Skinner GRB, Holmes D, Ahmad A, Davies JA, Benitez J. J Nutr Environ Med 2000;10:115-124.

  8. An Example: Hypothyroidism

  9. An Example: Hypothyroidism Sensitivity is 18/32 = 0.56 Specificity is 92/93 = 0.99

  10. An Example: Hypothyroidism Sensitivity is 25/32 = 0.78 Specificity is 75/93 = 0.81

  11. An Example: Hypothyroidism Sensitivity is 29/32 = 0.91 Specificity is 39/93 = 0.42

  12. An Example: Hypothyroidism

  13. An Example: Hypothyroidism

  14. A Universal Illustration

  15. Comparison of ROC Curve

  16. The idea behind artificial neural networks The brain of a vertebrate is (in general) capable of learning things Example: having seen a number of trees, a normally gifted person will be able to recognise almost all types of trees The idea: to construct networks of artificial neurons and make them learn and generalize in a way similar to how the physiological neural networks do that

  17. The feed-forward neural network - the training principle input hidden output layer layer layer weights • Data presented at input Correct answer fixed at output Difference between correct and actual output used for weight adjusting (training) sequence input data ... ...

  18. When to stop training We want to get a good generalization performance and to avoid over-fitting of the parameters to the training set (over-training)‏ test set training set error epoch

  19. The training set - large enough - contain all possible classes in approximately equal amounts - unbiased, i.e. no particular type within a class should be overrepresented --- this is important for two reasons: - if training set is biased towards a particular type, so will the ANN be - if training and test set contain too similar examples, the performance will be over-estimated in short: the training set should be representative

  20. Cross-validation N-fold cross-validation: divide the data set into n parts use n-1 parts for training use 1 part for testing e.g.., split the total data set into 5 parts: - 4 parts for training - 1 part for testing

  21. Support Vector Machines (SVM)

  22. Linear Classifiers f(x,w,b) = sign(w x+ b) denotes +1 denotes -1 w x+ b>0 w x+ b=0 How would you classify this data? w x+ b<0

  23. Linear Classifiers f(x,w,b) = sign(w x +b) denotes +1 denotes -1 How would you classify this data?

  24. Linear Classifiers f(x,w,b) = sign(w x+ b) denotes +1 denotes -1 How would you classify this data?

  25. Linear Classifiers f(x,w,b) = sign(w x+ b) denotes +1 denotes -1 Any of these would be fine.. ..but which is best?

  26. Classifier Margin Classifier Margin f(x,w,b) = sign(w x +b) f(x,w,b) = sign(w x +b) denotes +1 denotes -1 denotes +1 denotes -1 Define the margin of a linear classifier as the width that the boundary could be increased by before hitting a datapoint. Define the margin of a linear classifier as the width that the boundary could be increased by before hitting a datapoint.

  27. Maximum Margin • Maximizing the margin is good according to intuition and PAC theory • Implies that only support vectors are important; other training examples are ignorable. • Empirically it works very very well. f(x,w,b) = sign(w x+ b) denotes +1 denotes -1 The maximum margin linear classifier is the linear classifier with the, um, maximum margin. This is the simplest kind of SVM (Called an LSVM) Support Vectors are those datapoints that the margin pushes up against Linear SVM

  28. Maximum Margin x+ M=Margin Width “Predict Class = +1” zone What we know: • w . x+ + b = +1 • w . x- + b = -1 • w . (x+-x-) = 2 X- wx+b=1 “Predict Class = -1” zone wx+b=0 wx+b=-1

  29. Linear SVM Mathematically • Goal: 1) Correctly classify all training data if yi = +1 if yi = -1 for all i 2) Maximize the Margin same as minimize • We can formulate a Quadratic Optimization Problem and solve for w and b • Minimize subject to

  30. Solving the Optimization Problem • Need to optimize a quadratic function subject to linear constraints. • Quadratic optimization problems are a well-known class of mathematical programming problems, and many (rather intricate) algorithms exist for solving them. • The solution involves constructing a dual problem where a Lagrange multiplierαi is associated with every constraint in the primary problem: Find w and b such that Φ(w) =½ wTw is minimized; and for all {(xi,yi)}: yi (wTxi+ b)≥ 1 Find α1…αNsuch that Q(α) =Σαi- ½ΣΣαiαjyiyjxiTxjis maximized and (1)Σαiyi= 0 (2) αi≥ 0 for all αi

  31. The Optimization Problem Solution • The solution has the form: • Each non-zero αi indicates that corresponding xi is a support vector. • Then the classifying function will have the form: • Notice that it relies on an inner product between the test point xand the support vectors xi – we will return to this later. • Also keep in mind that solving the optimization problem involved computing the inner products xiTxj between all pairs of training points. w =Σαiyixi b= yk- wTxkfor any xksuch that αk 0 f(x) = ΣαiyixiTx + b

  32. denotes +1 denotes -1 Dataset with noise • Hard Margin: So far we require all data points be classified correctly - No training error • What if the training set is noisy? - Solution 1: use very powerful kernels OVERFITTING!

  33. e11 e2 wx+b=1 e7 wx+b=0 wx+b=-1 Soft Margin Classification Slack variablesξi can be added to allow misclassification of difficult or noisy examples. What should our quadratic optimization criterion be? Minimize

  34. Hard Margin v.s. Soft Margin • The old formulation: • The new formulation incorporating slack variables: • Parameter C can be viewed as a way to control overfitting. Find w and b such that Φ(w) =½ wTw is minimized and for all {(xi,yi)} yi (wTxi+ b)≥ 1 Find w and b such that Φ(w) =½ wTw + CΣξi is minimized and for all {(xi,yi)} yi(wTxi+ b)≥ 1- ξi and ξi≥ 0 for all i

  35. Linear SVMs: Overview • The classifier is a separating hyperplane. • Most “important” training points are support vectors; they define the hyperplane. • Quadratic optimization algorithms can identify which training points xi are support vectors with non-zero Lagrangian multipliers αi. • Both in the dual formulation of the problem and in the solution training points appear only inside dot products: Find α1…αNsuch that Q(α) =Σαi- ½ΣΣαiαjyiyjxiTxj is maximized and (1) Σαiyi= 0 (2) 0 ≤αi≤ C for all αi f(x) = ΣαiyixiTx + b

  36. x 0 x 0 x2 Non-linear SVMs • Datasets that are linearly separable with some noise work out great: • But what are we going to do if the dataset is just too hard? • How about… mapping data to a higher-dimensional space: 0 x

  37. Non-linear SVMs: Feature spaces • General idea: the original input space can always be mapped to some higher-dimensional feature space where the training set is separable: Φ: x→φ(x)

  38. The “Kernel Trick” • The linear classifier relies on dot product between vectors K(xi,xj)=xiTxj • If every data point is mapped into high-dimensional space via some transformation Φ: x→ φ(x), the dot product becomes: K(xi,xj)= φ(xi)Tφ(xj) • A kernel function is some function that corresponds to an inner product in some expanded feature space. • Example: 2-dimensional vectors x=[x1 x2]; let K(xi,xj)=(1 + xiTxj)2, Need to show that K(xi,xj)= φ(xi)Tφ(xj): K(xi,xj)=(1 + xiTxj)2, = 1+ xi12xj12 + 2 xi1xj1xi2xj2+ xi22xj22 + 2xi1xj1 + 2xi2xj2 = [1 xi12 √2 xi1xi2 xi22 √2xi1 √2xi2]T [1 xj12 √2 xj1xj2 xj22 √2xj1 √2xj2] = φ(xi)Tφ(xj), where φ(x) = [1 x12 √2 x1x2 x22 √2x1 √2x2]

  39. Examples of Kernel Functions • Linear: K(xi,xj)= xi Txj • Polynomial of power p: K(xi,xj)= (1+xi Txj)p • Gaussian (radial-basis function network): • Sigmoid: K(xi,xj)= tanh(β0xi Txj + β1)

  40. Non-linear SVMs Mathematically • Dual problem formulation: • The solution is: • Optimization techniques for finding αi’s remain the same! Find α1…αNsuch that Q(α) =Σαi- ½ΣΣαiαjyiyjK(xi,xj) is maximized and (1) Σαiyi= 0 (2) αi≥ 0 for all αi f(x) = ΣαiyiK(xi,xj)+ b

  41. Nonlinear SVM - Overview • SVM locates a separating hyperplane in the feature space and classify points in that space • It does not need to represent the space explicitly, simply by defining a kernel function • The kernel function plays the role of the dot product in the feature space.

  42. SVM Applications • SVM has been used successfully in many real-world problems - text (and hypertext) categorization - image classification - bioinformatics (Protein classification, Cancer classification) - hand-written character recognition

  43. Useful Toolboxes • PRtools • STPRtool • OSU-SVM • SVMlight • MATLABArsenal • DENFIS • ….

More Related