Non-Bayesian Classifiers Part II: Linear Discriminants and Support Vector Machines

Similar documents
Support Vector Machine (continued)

Support Vector Machine (SVM) & Kernel CE-717: Machine Learning Sharif University of Technology. M. Soleymani Fall 2012

Support Vector Machine (SVM) and Kernel Methods

Pattern Recognition 2018 Support Vector Machines

Data Mining. Linear & nonlinear classifiers. Hamid Beigy. Sharif University of Technology. Fall 1396

Linear & nonlinear classifiers

LINEAR CLASSIFICATION, PERCEPTRON, LOGISTIC REGRESSION, SVC, NAÏVE BAYES. Supervised Learning

Kernel Methods and Support Vector Machines

Introduction to Support Vector Machines

Jeff Howbert Introduction to Machine Learning Winter

Bayesian Decision Theory

Linear vs Non-linear classifier. CS789: Machine Learning and Neural Network. Introduction

Support Vector Machines Explained

Linear classifiers selecting hyperplane maximizing separation margin between classes (large margin classifiers)

Linear & nonlinear classifiers

Support Vector Machine (SVM) and Kernel Methods

Support Vector Machine

CS798: Selected topics in Machine Learning

Support Vector Machines. Introduction to Data Mining, 2 nd Edition by Tan, Steinbach, Karpatne, Kumar

Linear classifiers selecting hyperplane maximizing separation margin between classes (large margin classifiers)

Lecture 10: A brief introduction to Support Vector Machine

Machine Learning and Data Mining. Support Vector Machines. Kalev Kask

ML (cont.): SUPPORT VECTOR MACHINES

Support Vector Machine & Its Applications

Perceptron Revisited: Linear Separators. Support Vector Machines

Support Vector Machines. CSE 6363 Machine Learning Vassilis Athitsos Computer Science and Engineering Department University of Texas at Arlington

Support Vector Machine (SVM) and Kernel Methods

Lecture 9: Large Margin Classifiers. Linear Support Vector Machines

Max Margin-Classifier

Linear Classification and SVM. Dr. Xin Zhang

Support Vector Machines II. CAP 5610: Machine Learning Instructor: Guo-Jun QI

Pattern Recognition and Machine Learning. Perceptrons and Support Vector machines

Support Vector Machines, Kernel SVM

Support Vector Machines for Classification and Regression. 1 Linearly Separable Data: Hard Margin SVMs

Support Vector Machines

Statistical Machine Learning from Data

Cheng Soon Ong & Christian Walder. Canberra February June 2018

Linear classifiers selecting hyperplane maximizing separation margin between classes (large margin classifiers)

Machine Learning Support Vector Machines. Prof. Matteo Matteucci

(Kernels +) Support Vector Machines

Support Vector Machines

Support Vector Machines (SVM) in bioinformatics. Day 1: Introduction to SVM

Learning with kernels and SVM

Statistical Pattern Recognition

Support Vector Machines.

Support'Vector'Machines. Machine(Learning(Spring(2018 March(5(2018 Kasthuri Kannan

Machine Learning. Support Vector Machines. Manfred Huber

Linear Support Vector Machine. Classification. Linear SVM. Huiping Cao. Huiping Cao, Slide 1/26

Lecture Support Vector Machine (SVM) Classifiers

Support Vector Machines for Classification and Regression

10/05/2016. Computational Methods for Data Analysis. Massimo Poesio SUPPORT VECTOR MACHINES. Support Vector Machines Linear classifiers

Review: Support vector machines. Machine learning techniques and image analysis

Support Vector Machine

About this class. Maximizing the Margin. Maximum margin classifiers. Picture of large and small margin hyperplanes

Outline. Basic concepts: SVM and kernels SVM primal/dual problems. Chih-Jen Lin (National Taiwan Univ.) 1 / 22

Machine Learning And Applications: Supervised Learning-SVM

CS6375: Machine Learning Gautam Kunapuli. Support Vector Machines

Convex Optimization and Support Vector Machine

Support Vector Machines and Kernel Methods

Support Vector Machine for Classification and Regression

SUPPORT VECTOR MACHINE

LINEAR CLASSIFIERS. J. Elder CSE 4404/5327 Introduction to Machine Learning and Pattern Recognition

Support Vector Machines

COMS 4721: Machine Learning for Data Science Lecture 10, 2/21/2017

Machine Learning : Support Vector Machines

NONLINEAR CLASSIFICATION AND REGRESSION. J. Elder CSE 4404/5327 Introduction to Machine Learning and Pattern Recognition

Announcements - Homework

Introduction to Support Vector Machines

Statistical Methods for SVM

Chapter 9. Support Vector Machine. Yongdai Kim Seoul National University

Lecture 10: Support Vector Machine and Large Margin Classifier

Mark your answers ON THE EXAM ITSELF. If you are not sure of your answer you may wish to provide a brief explanation.

A short introduction to supervised learning, with applications to cancer pathway analysis Dr. Christina Leslie

Sparse Kernel Machines - SVM

CS145: INTRODUCTION TO DATA MINING

Linear, threshold units. Linear Discriminant Functions and Support Vector Machines. Biometrics CSE 190 Lecture 11. X i : inputs W i : weights

CSC 411 Lecture 17: Support Vector Machine

CIS 520: Machine Learning Oct 09, Kernel Methods

Constrained Optimization and Support Vector Machines

Support Vector Machines and Speaker Verification

Statistical Methods for NLP

COMS 4771 Introduction to Machine Learning. Nakul Verma

Support Vector Machines

Kernel Machines. Pradeep Ravikumar Co-instructor: Manuela Veloso. Machine Learning

Lecture Notes on Support Vector Machine

Polyhedral Computation. Linear Classifiers & the SVM

Support Vector Machines

Indirect Rule Learning: Support Vector Machines. Donglin Zeng, Department of Biostatistics, University of North Carolina

Kernel Methods. Charles Elkan October 17, 2007

Neural Networks. Prof. Dr. Rudolf Kruse. Computational Intelligence Group Faculty for Computer Science

Machine Learning Basics Lecture 4: SVM I. Princeton University COS 495 Instructor: Yingyu Liang

Support Vector Machines. CAP 5610: Machine Learning Instructor: Guo-Jun QI

A vector from the origin to H, V could be expressed using:

Data Mining - SVM. Dr. Jean-Michel RICHER Dr. Jean-Michel RICHER Data Mining - SVM 1 / 55

Support Vector Machines and Kernel Methods

Support Vector Machines

Support Vector Machines for Classification: A Statistical Portrait

CS4495/6495 Introduction to Computer Vision. 8C-L3 Support Vector Machines

Introduction to SVM and RVM

Machine Learning. Lecture 6: Support Vector Machine. Feng Li.

Transcription:

Non-Bayesian Classifiers Part II: Linear Discriminants and Support Vector Machines Selim Aksoy Department of Computer Engineering Bilkent University saksoy@cs.bilkent.edu.tr CS 551, Fall 2018 CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 1 / 25

Linear Discriminant Functions A classifier that uses discriminant functions assigns a feature vector x to class w i if g i (x) > g j (x) j i where g i (x), i = 1,..., c, are the discriminant functions for c classes. A discriminant function that is a linear combination of the components of x is called a linear discriminant function and can be written as g(x) = w T x + w 0 where w is the weight vector and w 0 is the bias (or threshold weight). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 2 / 25

The Two-Category Case For the two-category case, the decision rule can be written as Decide w 1 if g(x) > 0 otherwise w 2 The equation g(x) = 0 defines the decision boundary that separates points assigned to w 1 from points assigned to w 2. When g(x) is linear, the decision surface is a hyperplane whose orientation is determined by the normal vector w and location is determined by the bias w 0. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 3 / 25

The Multicategory Case There is more than one way to devise multicategory classifiers with linear discriminant functions. For example, we can pose the problem as c two-class problems, where the i th problem is solved by a linear discriminant that separates points assigned to w i from those not assigned to w i. Alternatively, we can use c(c 1)/2 linear discriminants, one for every pair of classes. Also, we can use c linear discriminants, one for each class, and assign x to w i if g i (x) > g j (x) for all j i. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 4 / 25

The Multicategory Case (a) Boundaries separate w i from w i. (b) Boundaries separate w i from w j. Figure 1: Linear decision boundaries for a four-class problem devised as four two-class problems (left figure) and six pairwise problems (right figure). The pink regions have ambiguous category assignments. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 5 / 25

The Multicategory Case Figure 2: Linear decision boundaries produced by using one linear discriminant for each class. w i w j is the normal vector for the decision boundary that separates the decision region for class w i from class w j. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 6 / 25

Generalized Linear Discriminant Functions The linear discriminant function g(x) can be written as g(x) = w 0 + d w i x i i=1 where w = (w 1,..., w d ) T. We can obtain the quadratic discriminant function by adding second-order terms as g(x) = w 0 + d w i x i + i=1 d d w ij x i x j i=1 j=1 which result in more complicated decision boundaries (hyperquadrics). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 7 / 25

Generalized Linear Discriminant Functions Adding higher-order terms gives the generalized linear discriminant function d g(x) = a i y i (x) = a T y i=1 where a is a d -dimensional weight vector and d functions y i (x) are arbitrary functions of x. The physical interpretation is that the functions y i (x) map point x in d-dimensional space to point y in d -dimensional space. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 8 / 25

Generalized Linear Discriminant Functions Then, the discriminant g(x) = a T y separates points in the transformed space using a hyperplane passing through the origin. This mapping to a higher dimensional space brings problems and additional requirements for computation and data. However, certain assumptions can make the problem tractable. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 9 / 25

Generalized Linear Discriminant Functions Figure 3: Mapping from R 2 to R 3 where points (x 1, x 2 ) T in the original space become (y 1, y 2, y 3 ) T = (x 2 1, 2x 1 x 2, x 2 2) T in the new space. The planar decision boundary in the new space corresponds to a non-linear decision boundary in the original space. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 10 / 25

Generalized Linear Discriminant Functions Figure 4: Mapping from R 2 to R 3 where points (x 1, x 2 ) T in the original space become (y 1, y 2, y 3 ) T = (x 1, x 2, αx 1 x 2 ) T in the new space. The decision regions ˆR 1 and ˆR 2 are separated by a plane in the new space where the corresponding regions R 1 and R 2 in the original space are separated by non-linear boundaries (R 1 is also not connected). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 11 / 25

We have seen that linear discriminant functions are optimal if the underlying distributions are Gaussians having equal covariance for each class. In the general case, the problem of finding linear discriminant functions can be formulated as a problem of optimizing a criterion function. Among all hyperplanes separating the data, there exists a unique one yielding the maximum margin of separation between the classes. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 12 / 25

y = 1 y = 0 y = 1 y = 1 y = 0 y = 1 margin Figure 5: The margin is defined as the perpendicular distance between the decision boundary and the closest of the data points (left). Maximizing the margin leads to a particular choice of decision boundary (right). The location of this boundary is determined by a subset of the data points, known as the support vectors, which are indicated by the circles. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 13 / 25

Given a set of training patterns and class labels as (x 1, y 1 ),..., (x n, y n ) R d {±1}, the goal is to find a classifier function f : R d {±1} such that f(x) = y will correctly classify new patterns. Support vector machines are based on the class of hyperplanes (w x) + b = 0, w R d, b R corresponding to decision functions f(x) = sign((w x) + b). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 14 / 25

Figure 6: A binary classification problem of separating balls from diamonds. The optimal hyperplane is orthogonal to the shortest line connecting the convex hulls of the two classes (dotted), and intersects it half way between the two classes. There is a weight vector w and a threshold b such that the points closest to the hyperplane satisfy (w x i ) + b = 1 corresponding to y i ((w x i ) + b) 1. The margin, measured perpendicularly to the hyperplane, equals 2/ w. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 15 / 25

To construct the optimal hyperplane, we can define the following optimization problem: minimize 1 2 w 2 subject to y i ((w x i ) + b) 1, i = 1,..., n. This constrained optimization problem is solved using Lagrange multipliers α i 0 and the Lagrangian L(w, b, α) = 1 n 2 w 2 α i (y i ((w x i ) + b) 1) where L has to be minimized w.r.t. the prime variables w and b, and maximized w.r.t. the dual variables α i. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 16 / 25 i=1

The solution can be obtained using quadratic programming techniques where the solution vector w = n α i y i x i i=1 is the summation of a subset of the training patterns, called the support vectors, whose α i are non-zero. The support vectors lie on the margin and carry all relevant information about the classification problem (the remaining patterns are irrelevant). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 17 / 25

The value of b can be computed as the solution of α i (y i ((w x i ) + b) 1) = 0 using any of the support vectors but it is numerically safer to take the average value of b resulting from all such equations. In many real-world problems there will be no linear boundary separating the classes and the problem of searching for an optimal separating hyperplane is meaningless. However, we can extend the above ideas to handle non-separable data by relaxing the constraints. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 18 / 25

The new optimization problem becomes: minimize 1 n 2 w 2 + C i=1 subject to (w x i ) + b +1 ξ i for y i = +1, ξ i (w x i ) + b 1 + ξ i for y i = 1, ξ i 0 i = 1,..., n where ξ i, i = 1,..., n, are called the slack variables and C is a regularization parameter. The term C n i=1 ξ i can be thought of as measuring some amount of misclassification where lowering the value of C corresponds to a smaller penalty for misclassification (see references). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 19 / 25

ξ > 1 y = 1 y = 0 y = 1 ξ < 1 ξ = 0 ξ = 0 Figure 7: Illustration of the slack variables ξ i 0. Data points with circles around them are support vectors. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 20 / 25

Both the quadratic programming problem and the final decision function f(x) = sign ( n α i y i (x x i ) + b i=1 ) depend only on the dot products between patterns. We can generalize this result to the non-linear case by mapping the original input space into some other space F using a non-linear map Φ : R d F and perform the linear algorithm in the F space which only requires the dot products k(x, y) = Φ(x)Φ(y). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 21 / 25

Even though F may be high-dimensional, a simple kernel k(x, y) such as the following can be computed efficiently. Table 1: Common kernel functions. Polynomial k(x, y) = (x y) p Sigmoidal k(x, y) = tanh(κ(x y) + θ) Radial basis function k(x, y) = exp( x y 2 /(2σ 2 )) Once a kernel function is chosen, we can substitute Φ(x i ) for each training example x i, and perform the optimal hyperplane algorithm in F. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 22 / 25

This results in the non-linear decision function of the form ( n ) f(x) = sign α i y i k(x, x i ) + b i=1 where the parameters α i are computed as the solution of the quadratic programming problem. In the original input space, the hyperplane corresponds to a non-linear decision function whose form is determined by the kernel. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 23 / 25

SVMs are quite popular because of their intuitive formulation using computational learning theory and their high performances in practical applications. However, we must be careful about certain issues such as the following during implementation. Choice of kernel functions: We can use training data to find the best performing kernel. Computational requirements of the quadratic program: Several algorithms exist for speeding up the optimization problem (see references). CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 24 / 25

Extension to multiple classes: We can train a separate SVM for each class, compute the output value using each SVM, and select the class that assigns the unknown pattern the furthest into the positive region. Converting the output of an SVM to a posterior probability for post-processing: We can fit a sigmoid model to the posterior probability P (y = 1 f(x)) as P (y = 1 f(x)) = 1 1 + exp(a f(x) + b) where the parameters a and b are learned using maximum likelihood estimation from a training set. CS 551, Fall 2018 c 2018, Selim Aksoy (Bilkent University) 25 / 25