Download presentation

Presentation is loading. Please wait.

Published byJaylen Wiggins Modified over 2 years ago

1
CSE489-02 & CSE589-02 Multimedia Processing Lecture 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: 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 Sensitivity and Specificity

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

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

6
Performance Measurements Matthew's correlation coefficient for a 2-category predictor: Sensitivity= tp/(tp+fn) the fraction of the sequences that belong to a certain class that really are predicted to that class Specificity= tp/(tp+fp) the fraction of the sequences that are predicted to a certain class that really belong to that class

7
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

8
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.

9
An Example: Hypothyroidism

10
Sensitivity is 18/32 = 0.56 Specificity is 92/93 = 0.99

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

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

13
An Example: Hypothyroidism

15
A Universal Illustration

16
Comparison of ROC Curve

18
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

19
Different types of NNs Supervised vs. unsupervised NNs: Supervised - e.g. "feed-forward": - used for classification of patterns, e.g. does this protein contain a particular sequence motif ? - the "correct answer" is known and used in the training - synapse weights are updated based on difference between actual and desired output Unsupervised - e.g. "SOM": - used for clustering of sequences - the "correct answer" is not used in the training - synapse weights are updated based on how often a particular synapse is used

20
The feed-forward neural network - a (slightly) more realistic data set some feature another feature class 1 class 2

21
The feed-forward neural network - a more realistic architecture input layer hidden layer output layer x 1 x n logistic neurons is the most commonly used type n typically in the range [2,100]...

22
The feed-forward neural network - important considerations (learning = training) => will use the example of amino acid sequence from now on - encoding of input (amino acid sequence into numbers) - learning algorithm and learning rate - the training set: must be representative - when to stop the training (the number of epochs)? - post-processing (i.e. interpretation of output) - how to measure performance?

23
The feed-forward neural network - important considerations The training set should contain sequences from both (all) classes in approx. equal amounts data set training set: used for training test set: used only for testing, completely left out of training

24
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

25
The feed-forward neural network - the training algorithm 1. Start with random weights 2. Show one input example and calculate output 3. Calculate output errors (difference between observed and desired output) 4. Adjust weights to decrease the error (using error backprop. alg.) 5. Repeat (2)-(4) for all input examples 6. Repeat (2)-(5) until error minimum is found (each repeat is called an epoch)(typically 50-1000 epochs)

26
When to stop training error epoch 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

27
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

28
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

29
Support Vector Machines (SVM)

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

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

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

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

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

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

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

37
Linear SVM Mathematically Goal: 1) Correctly classify all training data if y i = +1 if y i = -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

38
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) =½ w T w is minimized; and for all { ( x i,y i )} : y i (w T x i + b) ≥ 1 Find α 1 …α N such that Q( α ) = Σ α i - ½ ΣΣ α i α j y i y j x i T x j is maximized and (1) Σ α i y i = 0 (2) α i ≥ 0 for all α i

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

40
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 denotes +1 denotes -1 OVERFITTING!

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

42
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) =½ w T w is minimized and for all { ( x i,y i )} y i (w T x i + b) ≥ 1 Find w and b such that Φ(w) =½ w T w + C Σ ξ i is minimized and for all { ( x i,y i )} y i (w T x i + b) ≥ 1- ξ i and ξ i ≥ 0 for all i

43
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 x i 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 …α N such that Q(α) =Σα i - ½ΣΣα i α j y i y j x i T x j is maximized and (1) Σα i y i = 0 (2) 0 ≤ α i ≤ C for all α i f(x) = Σ α i y i x i T x + b

44
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 0 x 0 x x2x2

45
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)

46
The “ Kernel Trick ” The linear classifier relies on dot product between vectors K(x i,x j )=x i T x j If every data point is mapped into high-dimensional space via some transformation Φ: x → φ(x), the dot product becomes: K(x i,x j )= φ(x i ) T φ(x j ) A kernel function is some function that corresponds to an inner product in some expanded feature space. Example: 2-dimensional vectors x=[x 1 x 2 ]; let K(x i,x j )=(1 + x i T x j ) 2, Need to show that K(x i,x j )= φ(x i ) T φ(x j ): K(x i,x j )=(1 + x i T x j ) 2, = 1+ x i1 2 x j1 2 + 2 x i1 x j1 x i2 x j2 + x i2 2 x j2 2 + 2x i1 x j1 + 2x i2 x j2 = [1 x i1 2 √2 x i1 x i2 x i2 2 √2x i1 √2x i2 ] T [1 x j1 2 √2 x j1 x j2 x j2 2 √2x j1 √2x j2 ] = φ(x i ) T φ(x j ), where φ(x) = [1 x 1 2 √2 x 1 x 2 x 2 2 √2x 1 √2x 2 ]

47
Examples of Kernel Functions Linear: K(x i,x j )= x i T x j Polynomial of power p: K(x i,x j )= (1+ x i T x j ) p Gaussian (radial-basis function network): Sigmoid: K(x i,x j )= tanh(β 0 x i T x j + β 1 )

48
Non-linear SVMs Mathematically Dual problem formulation: The solution is: Optimization techniques for finding α i ’s remain the same! Find α 1 …α N such that Q(α) =Σα i - ½ΣΣα i α j y i y j K(x i, x j ) is maximized and (1) Σα i y i = 0 (2) α i ≥ 0 for all α i f(x) = Σα i y i K(x i, x j )+ b

49
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. Nonlinear SVM - Overview

50
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

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

Similar presentations

OK

1 Machine Learning Support Vector Machines. 2 Perceptron Revisited: Linear Separators Binary classification can be viewed as the task of separating classes.

1 Machine Learning Support Vector Machines. 2 Perceptron Revisited: Linear Separators Binary classification can be viewed as the task of separating classes.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on information system security Ppt on acid-base indicators chemistry Ppt on nitrogen cycle and nitrogen fixation cycle Ppt on prime numbers Ppt on viruses and anti viruses available Download ppt on air powered cars Ppt on tunnel diode operation Ppt on energy giving foods Ppt on chromosomes and genes Ppt on zener diode polarity