Applied and Computational Mathematics
Volume 6, Issue 4-1, July 2017, Pages: 1-15

Tutorial on Support Vector Machine

Loc Nguyen

Sunflower Soft Company, Ho Chi Minh City, Vietnam

Email address:

To cite this article:

Loc Nguyen. Tutorial on Support Vector Machine. Applied and Computational Mathematics. Special Issue: Some Novel Algorithms for Global Optimization and Relevant Subjects. Vol. 6, No. 4-1, 2017, pp. 1-15. doi: 10.11648/j.acm.s.2017060401.11

Received: September 7, 2015; Accepted: September 8, 2015; Published: June 17, 2016


Abstract: Support vector machine is a powerful machine learning method in data classification. Using it for applied researches is easy but comprehending it for further development requires a lot of efforts. This report is a tutorial on support vector machine with full of mathematical proofs and example, which help researchers to understand it by the fastest way from theory to practice. The report focuses on theory of optimization which is the base of support vector machine.

Keywords: Support Vector Machine, Optimization, Separating Hyperplane, Sequential Minimal Optimization


1. Support Vector Machine

Figure 1. Separating hyperplanes.

Support vector machine (SVM) [1] is a supervised learning algorithm for classification and regression. Given a set of p-dimensional vectors in vector space, SVM finds the separating hyperplane that splits vector space into sub-set of vectors; each separated sub-set (so-called data set) is assigned by one class. There is the condition for this separating hyperplane: "it must maximize the margin between two sub-sets". Fig. 1 [2] shows separating hyperplanes H1, H2, and H3 in which only H2 gets maximum margin according to this condition.

Suppose we have some p-dimensional vectors; each of them belongs to one of two classes. We can find many p–1 dimensional hyperplanes that classify such vectors but there is only one hyperplane that maximizes the margin between two classes. In other words, the nearest between one side of this hyperplane and other side of this hyperplane is maximized. Such hyperplane is called maximum-margin hyperplane and it is considered as the SVM classifier.

Let {X1, X2,…, Xn} be the training set of n vectors Xi (s) and let yi = {+1, –1} be the class label of vector Xi. Each Xi is also called a data point with attention that vectors can be identified with data points and data point can be called point, in brief. It is necessary to determine the maximum-margin hyperplane that separates data points belonging to yi=+1 from data points belonging to yi=–1 as clear as possible.

According to theory of geometry, arbitrary hyperplane is represented as a set of points satisfying hyperplane equation specified by (1).

(1)

Where the sign "" denotes the dot product or scalar product and W is weight vector perpendicular to hyperplane and b is the bias. Vector W is also called perpendicular vector or normal vector and it is used to specify hyperplane. Suppose W=(w1, w2,…, wp) and Xi=(xi1, xi2,…, xip), the scalar product  is:

Given scalar value w, the multiplication of w and vector Xi denoted wXi is a vector as follows:

Please distinguish scalar product  and multiplication wXi.

The essence of SVM method is to find out weight vector W and bias b so that the hyperplane equation specified by (1) expresses the maximum-margin hyperplane that maximizes the margin between two classes of training set.

The value b/|W| is the offset of the (maximum-margin) hyperplane from the origin along the weight vector W where |W| or ||W|| denotes length or module of vector W.

Note that we use two notations |.| and ||.|| for denoting the length of vector.

Figure 2. Maximum-margin hyperplane, parallel hyperplanes and weight vector W.

Additionally, the value 2/|W| is the width of the margin as seen in fig. 2. To determine the margin, two parallel hyperplanes are constructed, one on each side of the maximum-margin hyperplane. Such two parallel hyperplanes are represented by two hyperplane equations, as shown in (2) as follows.

(2)

Fig. 2 [2] illustrates maximum-margin hyperplane, weight vector W and two parallel hyperplanes. As seen in the fig. 2, the margin is limited by such two parallel hyperplanes. Exactly, there are two margins (each one for a parallel hyperplane) but it is convenient for referring both margins as the unified single margin as usual. You can imagine such margin as a road and SVM method aims to maximize the width of such road. Data points lying on (or are very near to) two parallel hyperplanes are called support vectors because they construct mainly the maximum-margin hyperplane in the middle. This is the reason that the classification method is called support vector machine (SVM).

To prevent vectors from falling into the margin, all vectors belonging to two classes yi=1 and yi=–1 have two following constraints, respectively:

As seen in fig. 2, vectors (data points) belonging to classes yi=+1 and yi=–1 are depicted as black circles and white circles, respectively. Such two constraints are unified into the so-called classification constraint specified by (3) as follows:

(3)

As known, yi=+1 and yi=–1 represent two classes of data points. It is easy to infer that maximum-margin hyperplane which is the result of SVM method is the classifier that aims to determined which class (+1 or –1) a given data point X belongs to. Your attention please, each data point Xi in training set was assigned by a class yi before and maximum-margin hyperplane constructed from the training set is used to classify any different data point X.

Because maximum-margin hyperplane is defined by weight vector W, it is easy to recognize that the essence of constructing maximum-margin hyperplane is to solve the constrained optimization problem as follows:

Where |W| is the length of weight vector W and  is the classification constraint specified by (3). The reason of minimizing  is that distance between two parallel hyperplanes is 2/|W| and we need to maximize such distance in order to maximize the margin for maximum-margin hyperplane. Then maximizing 2/|W| is to minimize . Because it is complex to compute the length |W|, we substitute  for  when  is equal to the scalar product  as follows:

The constrained optimization problem is re-written, shown in (4) as below:

(4)

Where  is called target function with regard to variable W. Function  is called constraint function with regard to two variables W, b and it is derived from the classification constraint specified by (3). There are n constraints  because training set {X1, X2,…, Xn} has n data points Xi (s). Constraints  inside (3) implicate the perfect separation in which there is no data point falling into the margin (between two parallel hyperplanes, see fig. 2). On the other hand, the imperfect separation allows some data points to fall into the margin, which means that each constraint function gi(W,b) is subtracted by an error . The constraints become [3, p. 5]:

We have a n-component error vector ξ=(ξ1, ξ2,…, ξn) for n constraints. The penalty  is added to the target function in order to penalize data points falling into the margin. The penalty C is a pre-defined constant. Thus, the target function f(W) becomes:

If the positive penalty is infinity,  then, target function f(W) may get maximal when all errors ξi must be 0, which leads to the perfect separation specified by (4).

Equation (5) specifies the general form of constrained optimization originated from (4).

(5)

Where C ≥ 0 is the penalty.

The Lagrangian function [4, p. 215] is constructed from constrained optimization problem specified by (5). Let L(W, b, ξ, λ, μ) be Lagrangian function where λ=(λ1, λ2,…, λn) and μ=(μ1, μ2,…, μn) are n-component vectors, λi ≥ 0 and μi ≥ 0, . We have:

In general, (6) represents Lagrangian function as follows:

(6)

Note that λ=(λ1, λ2,…, λn) and μ=(μ1, μ2,…, μn) are called Lagrange multipliers or Karush-Kuhn-Tucker multipliers [5] or dual variables. The sign "" denotes scalar product and every training data point Xi was assigned by a class yi before.

Suppose (W*, b*) is solution of constrained optimization problem specified by (5) then, the pair (W*, b*) is minimum point of target function f(W) or target function f(W) gets minimum at (W*, b*) with all constraints . Note that W* is called optimal weight vector and b* is called optimal bias. It is easy to infer that the pair (W*, b*) represents the maximum-margin hyperplane and it is possible to identify (W*, b*) with the maximum-margin hyperplane. The ultimate goal of SVM method is to find out W* and b*. According to Lagrangian duality theorem [4, p. 216] [6, p. 8], the pair (W*, b*) is the extreme point of Lagrangian function as follows:

(7)

Where Lagrangian function L(W, b, ξ, λ, μ) is specified by (6).

Now it is necessary to solve the Lagrangian duality problem represented by (7) to find out W*. Thus, the Lagrangian function L(W, b, ξ, λ, μ) is minimized with respect to the primal variables W, b and maximized with respect to the dual variables λ=(λ1, λ2,…, λn) and μ=(μ1, μ2,…, μn), in turn. If gradient of L(W, b, ξ, λ, μ) is equal to zero then, L(W, b, ξ, λ, μ) will gets minimum value with note that gradient of a multi-variable function is the vector whose components are first-order partial derivative of such function. Thus, setting the gradient of L(W, b, ξ, λ, μ) with respect to W, b, and ξ to zero, we have:

In general, W* is determined by (8) as follows:

(8)

It is required to determine Lagrange multipliers λ=(λ1, λ2,…, λn) in order to evaluate W*. Substituting (8) into Lagrangian function L(W, b, ξ, λ, μ) specified by (6), we have:

(According to (8), L(W,b,ξ,λ,μ) gets minimum at  and  and )

Where l(λ) is called dual function represented by (9).

(9)

According to Lagrangian duality problem represented by (7), λ=(λ1, λ2,…, λn) is calculated as the maximum point λ*=(λ1*, λ2*,…, λn*) of dual function l(λ). In conclusion, maximizing l(λ) is the main task of SVM method because the optimal weight vector W* is calculated based on the optimal point λ* of dual function l(λ) according to (8).

Maximizing l(λ) is quadratic programming (QP) problem, specified by (10).

(10)

The constraints  are implied from the equations  when . The QP problem specified by (10) is also known as Wolfe problem [3, p. 42].

There are some methods to solve this QP problem but this report introduces a so-called Sequential Minimal Optimization (SMO) developed by author [7]. The SMO algorithm is very effective method to find out the optimal (maximum) point λ* of dual function l(λ).

Moreover SMO algorithm also finds out the optimal bias b*, which means that SVM classifier (W*, b*) is totally determined by SMO algorithm. The next section described SMO algorithm in detail.

2. Sequential Minimal Optimization

The ideology of SMO algorithm is to divide the whole QP problem into many smallest optimization problems. Each smallest problem relates to only two Lagrange multipliers. For solving each smallest optimization problem, SMO algorithm includes two nested loops as shown in table 1 [7, pp. 8-9]:

Table 1. Ideology of SMO algorithm.

SMO algorithm solves each smallest optimization problem via two nested loops:
1. The outer loop finds out the first Lagrange multiplier λi whose associated data point Xi violates KKT condition [5]. Violating KKT condition is known as the first choice heuristic.
2. The inner loop finds out the second Lagrange multiplier λj according to the second choice heuristic. The second choice heuristic that maximizes optimization step will be described later.
3. Two Lagrange multipliers λi and λj are optimized jointly according to QP problem specified by (10).
SMO algorithm continues to solve another smallest optimization problem. SMO algorithm stops when there is convergence in which no data point violating KKT condition is found; consequently, all Lagrange multipliers λ1, λ2,…, λn are optimized.

Before describing SMO algorithm in detailed, the KKT condition with subject to SVM is mentioned firstly because violating KKT condition is known as the first choice heuristic of SMO algorithm. KKT condition indicates both partial derivatives of Lagrangian function and complementary slackness are zero [5]. Referring (8) and (4), the KKT function of SVM is summarized as (11):

(11)

When we understand deeply convex optimization, the KKT condition is the same to the QP problem specified by (10) if target function and constraint sets are convex. Thus, the solution (W*, λ*) is saddle point of Lagrangian function.

KKT condition is analyzed into three following cases [3, p. 7]:

1.     If λi=0 then, μi = Cλi = C. It implies ξi=0 from equation . Then, from equation  we have:

2.     If 0 < λi < C then, we have . Due to μi = Cλi > 0, it implies ξi=0 from equation . It is easy to infer that:

3.     If λi=C then, we have μi = Cλi = 0 and . Due to μi = 0, it implies ξi ≥ 0 from equation . Given ξi ≥ 0 the equation  leads to:

Let  be prediction error, we have:

The KKT condition implies:

(12)

Equation (12) expresses directed corollaries from KKT condition. It is commented on (12) that if Ei=0, the KKT condition is always satisfied. Data points Xi satisfying equation yiEi=0 lie on the margin (lie on the two parallel hyperplanes). These points are called support vectors. According to KKT corollary, support vectors are always associated with non-zero Lagrange multipliers such that 0<λi<C. Note, such Lagrange multipliers 0<λi<C are also called non-boundary multipliers because they are not bounds such as 0 and C. So, support vectors are also known as non-boundary data points. It easy to infer from (8)

that support vectors along with their non-zero Lagrange multipliers form mainly the optimal weight vector W* representing the maximum-margin hyperplane – the SVM classifier. This is the reason that this classification approach is called support vector machine (SVM). Fig. 3 [8, p. 5] illustrates an example of support vectors.

Figure 3. Support vectors.

Violating KKT condition is the first choice heuristic of SMO algorithm. By negating three corollaries specified by (12), KKT condition is violated in three following cases:

By logic induction, these cases are reduced into two cases specified by (13).

(13)

Equation (13) is used to check whether given data point Xi violates KKT condition.

Figure 4. Linear constraint of two Lagrange multipliers.

The main task of SMO algorithm (see table 1) is to optimize jointly two Lagrange multipliers in order to solve each smallest optimization problem, which maximizes the dual function l(λ).

Where,

Without loss of generality, two Lagrange multipliers λi and λj that will be optimized are λ1 and λ2 while all other multipliers λ3, λ4,…, λn are fixed. Old values of λ1 and λ2 are denoted  and . Your attention please, old values are known as current values. Thus, λ1 and λ2 are optimized based on the set: , , λ2, λ3,…, λn. The old values  and  are initialized by zero [3, p. 9]. From the condition , we have:

and

It implies following equation of line with regard to two variables λ1 and λ2:

(14)

Equation (14) specifies the linear constraint of two Lagrange multipliers λ1 and λ2. This constraint is drawn as diagonal lines in fig. 4 [3, p. 9].

In fig. 4, the box is bounded by the interval [0, C] of Lagrange multipliers, . SMO algorithm moves λ1 and λ2 along diagonal lines so as to maximize the dual function l(λ). Multiplying two sides of equation

by y1, we have:

Where s=y1y2. Let,

We have (15) as a variant of the linear constraint of two Lagrange multipliers λ1 and λ2 [3, p. 9]:

(15)

By fixing multipliers λ3, λ4,…, λn, all arithmetic combinations of , , λ3, λ4,…, λn are constants denoted by term "const". The dual function l(λ) is re-written [3, pp. 9-11]:

Let,

Let  be the optimal weight vector  based on old values of two aforementioned Lagrange multipliers. Following linear constraint of two Lagrange multipliers specified by (14), we have:

 

Let,

We have [3, p. 10]:

 

 

 

Let  and assessing the coefficient of λ2, we have [3, p. 11]:

 

(Where  is the old value of the bias b)

According to (13),  and  are old prediction errors on X2 and X1, respectively:

Recall that we had:

Thus, equation (16) specifies dual function with subject to the second Lagrange multiplier λ2 that is optimized in conjunction with the first one λ1 by SMO algorithm.

(16)

The first and second derivatives of dual function l(λ2) with regard to λ2 are:

The quantity η is always non-negative due to:

Recall that the goal of QP problem is to maximize the dual function l(λ2) so as to find out the optimal multiplier (maximum point) . The second derivative of l(λ2) is always non-negative and so, l(λ2) is concave function and there always exists the maximum point . The function l(λ2) gets maximal if its first derivative is equal to zero:

Therefore, the new values of λ1 and λ2 that are solutions of the smallest optimization problem of SMO algorithm are:

 

 

Obviously,  is totally determined in accordance with , thus we should focus on . Because multipliers λi are bounded, , it is required to find out the range of . Let L and U be lower bound and upper bound of , respectively. We have [3, pp. 11-13]:

1.     If s = 1, then λ1 + λ2 = γ. There are two sub-cases (see fig. 5 [3, p. 12] ) as follows [3, p. 11]:

If γC then L = γC and U = C.

If γ < C then L = 0 and U = γ.

2.     If s = –1, then λ1 λ2 = γ. There are two sub-cases (see fig. 6 [3, p. 13]) as follows [3, pp. 11-12]:

If γ ≥ 0 then L = 0 and U = Cγ.

If γ < 0 then L = –γ and U = C.

Figure 5. Lower bound and upper bound of two new multipliers in case s = 1.

Figure 6. Lower bound and upper bound of two new multipliers in case s = –1.

Table 2. SMO algorithm optimizes jointly two Lagrange multipliers.

 

The value  is clipped as follows [3, p. 12]:

In the case η=0 that  is undetermined,  is assigned by which bound (L or U) maximizes the dual function l(λ2).

In general, table 2 summarizes how SMO algorithm optimizes jointly two Lagrange multipliers.

Basic tasks of SMO algorithm to optimize jointly two Lagrange multipliers are now described in detailed. The ultimate goal of SVM method is to determine the classifier (W*, b*). Thus, SMO algorithm updates optimal weight W* and optimal bias b* based on the new values  and  at each optimization step.

Table 3. SMO algorithm.

All multipliers λi (s), weight vector W, and bias b are initialized by zero. SMO algorithm divides the whole QP problem into many smallest optimization problems. Each smallest optimization problem focuses on optimizing two joint multipliers. SMO algorithm solves each smallest optimization problem via two nested loops:
1. The outer loop alternates one sweep through all data points and as many sweeps as possible through non-boundary data points (support vectors) so as to find out the data point Xi that violates KKT condition according to (13). The Lagrange multiplier λi associated with such Xi is selected as the first multiplier aforementioned as λ1. Violating KKT condition is known as the first choice heuristic of SMO algorithm.

2. The inner loop browses all data points at the first sweep and non-boundary ones at later sweeps so as to find out the data point Xj that maximizes the deviation  where  and  are prediction errors on Xi and Xj, respectively, as seen in (16). The Lagrange multiplier λj associated with such Xj is selected as the second multiplier aforementioned as λ2. Maximizing the deviation  is known as the second choice heuristic of SMO algorithm.

a.  Two Lagrange multipliers λ1 and λ2 are optimized jointly, which results optimal multipliers  and , as seen in table 2.

b. SMO algorithm updates optimal weight W* and optimal bias b* based on the new values  and  according to (17).

SMO algorithm continues to solve another smallest optimization problem. SMO algorithm stops when there is convergence in which no data point violating KKT condition is found. Consequently, all Lagrange multipliers λ1, λ2,…, λn are optimized and the optimal SVM classifier (W*, b*) is totally determined.

Let  be the new (optimal) weight vector, according (11) we have:

 

Let  be the old weight vector:

 

It implies:

Let  be the new prediction error on X2:

The new (optimal) bias  is determining by setting  with reason that the optimal classifier (W*, b*) has zero error.

In general, equation (17) specifies the optimal classifier (W*, b*) resulted from each optimization step of SMO algorithm.

(17)

By extending the ideology shown in table 1, SMO algorithm is described particularly in table 3 [7, pp. 8-9] [3, p. 14].

When both optimal weight vector W* and optimal bias b* are determined by SMO algorithm or other methods, the maximum-margin hyperplane known as SVM classifier is totally determined. According to (1), the equation of maximum-margin hyperplane is expressed in (18) as follows:

(18)

For any data point X, classification rule derived from maximum-margin hyperplane (SVM classifier) is used to classify such data point X. Let R be the classification rule, equation (19) specifies the classification rule as the sign function of point X.

(19)

After evaluating R with regard to X, if R(X) =1 then, X belongs to class +1; otherwise, X belongs to class –1. This is the simple process of data classification.

The next section illustrates how to apply SMO into classifying data points where such data points are documents.

3. An Example of Data Classification by SVM

Given a set of classes C = {computer science, math}, a set of terms T = {computer, derivative} and the corpus  = {doc1.txt, doc2.txt, doc3.txt, doc4.txt}. The training corpus (training data) is shown in following table 4 in which cell (i, j) indicates the number of times that term j (column j) occurs in document i (row i); in other words, each cell represents a term frequency and each row represents a document. There are four documents and each document belongs to only one class: computer science or math.

Table 4. Term frequencies of documents (SVM).

  computer derivative class
doc1.txt 20 55 math
doc2.txt 20 20 computer science
doc3.txt 15 30 math
doc4.txt 35 10 computer science

Let Xi be data points representing documents doc1.txt, doc2.txt, doc3.txt, doc4.txt, doc5.txt. We have X1=(20,55), X2=(20,20), X3=(15,30), and X4=(35,10). Let yi=+1 and yi=–1 represent classes "math" and "computer science", respectively. Let x and y represent terms "computer" and "derivative", respectively and so, for example, it is interpreted that the data point X1=(20,55) has abscissa x=20 and ordinate y=55. Therefore, term frequencies from table 4 is interpreted as SVM input training corpus shown in table 5.

Table 5. Training corpus (SVM).

  x y yi
X1 20 55 +1
X2 20 20 –1
X3 15 30 +1
X4 35 10 –1

Figure 7. Data points in training data (SVM).

Data points X1, X2, X3, and X4 are depicted in fig. 7 in which classes "math" (yi=+1) and "computer" (yi=–1) are represented by shading and hollow circles, respectively. Note that fig. 7 and fig. 8 in this report are drawn by the software Graph http://www.padowan.dk developed by author Ivan Johansen [9].

By applying SMO algorithm described in table 3 into training corpus shown in table 5, it is easy to calculate optimal multiplier λ*, optimal weight vector W* and optimal bias b*. Firstly, all multipliers λi (s), weight vector W, and bias b are initialized by zero. This example focuses on perfect separation and so, .

At the first sweep:

The outer loop of SMO algorithm searches for a data point Xi that violates KKT condition according to (13) through all data points so as to select two multipliers that will be optimized jointly. We have:

Due to λ1=0 < C=+∞ and y1E1=1*1=1 > 0, point X1 violates KKT condition according to (13). Then, λ1 is selected as the first multiplier. The inner loop finds out the data point Xj that maximizes the deviation . We have:

 

 

 

 

Because the deviation  is maximal, the multiplier λ2 associated with X2 is selected as the second multiplier. Now λ1 and λ2 are optimized jointly according to table 2.

 

 

 

 

 

Optimal classifier (W*, b*) is updated according to (17).

Now we have:

 

 

 

The outer loop of SMO algorithm continues to search for another data point Xi that violates KKT condition according to (13) through all data points so as to select two other multipliers that will be optimized jointly. We have:

Due to λ3=0 < C and y3E3=1*(10/7) > 0, point X3 violates KKT condition according to (13). Then, λ3 is selected as the first multiplier. The inner loop finds out the data point Xj that maximizes the deviation . We have:

 

 

 

 

Because both deviations  and  are maximal, the multiplier λ2 associated with X2 is selected randomly among {λ1, λ2} as the second multiplier. Now λ3 and λ2 are optimized jointly according to table 2.

 

 

 

 

(L and U are lower bound and upper bound of )

 

 

 

Optimal classifier (W*, b*) is updated according to (17).

Now we have:

 

 

 

The outer loop of SMO algorithm continues to search for another data point Xi that violates KKT condition according to (13) through all data points so as to select two other multipliers that will be optimized jointly. We have:

Due to λ4=0 < C and y4E4=(–1)*(18/7) < 0, point X4 does not violate KKT condition according to (13). Then, the first sweep of outer loop stops with the results as follows:

 

 

 

Note that λ1 is approximated to 0 because it is very small.

At the second sweep:

The outer loop of SMO algorithm searches for a data point Xi that violates KKT condition according to (13) through non-boundary data points so as to select two multipliers that will be optimized jointly. Recall that non-boundary data points (support vectors) are ones whose associated multipliers are not bounds 0 and C (0<λi<C). At the second sweep, there are three non-boundary data points X1, X2 and X3. We have:

Due to  and y1E1 = 1*(–4) < 0, point X1 violates KKT condition according to (13). Then, λ1 is selected as the first multiplier. The inner loop finds out the data point Xj among non-boundary data points (0<λi<C) that maximizes the deviation . We have:

 

 

Because the deviation  is maximal, the multiplier λ2 associated with X2 is selected as the second multiplier. Now λ1 and λ2 are optimized jointly according to table (2).

 

 

 

 

(L and U are lower bound and upper bound of )

 

 

 

Optimal classifier (W*, b*) is updated according to (17).

The second sweep stops with results as follows:

 

 

 

At the third sweep:

The outer loop of SMO algorithm searches for a data point Xi that violates KKT condition according to (13) through non-boundary data points so as to select two multipliers that will be optimized jointly. Recall that non-boundary data points (support vectors) are ones whose associated multipliers are not bounds 0 and C (0<λi<C). At the third sweep, there are only two non-boundary data points X2 and X3. We have:

 

Due to  and y3E3 = 1*(4/7) > 0, point X3 violates KKT condition according to (13). Then, λ3 is selected as the first multiplier. Because there are only two non-boundary data points X2 and X3, the second multiplier is λ2. Now λ3 and λ2 are optimized jointly according to table (2).

 

 

 

 

(L and U are lower bound and upper bound of )

Optimal classifier (W*, b*) is updated according to (17).

The third sweep stops with results as follows:

 

 

After the third sweep, two non-boundary multipliers were optimized jointly. You can sweep more times to get more optimal results because data point X3 still violates KKT condition as follows:

Due to  and y3E3 = 1*(–32/35) < 0, point X3 violates KKT condition according to (13). But it takes a lot of sweeps so that SMO algorithm reaches absolute convergence (E3=0 and hence, no KKT violation) because the penalty C is set to be +∞, which implicates the perfect separation. This is the reason that we can stop the SMO algorithm at the third sweep in this example. In general, you can totally stop the SMO algorithm after optimizing two last multipliers which implies that all multipliers were optimized.

As a result, W* and b* were determined:

 

 

The maximum-margin hyperplane (SVM classifier) is totally determined as below:

 

 

Figure 8. An example of maximum-margin hyperplane.

The SVM classifier  is depicted in fig. 8.

Where the maximum-margin hyperplane is draw as bold line. Data points X2 and X3 are support vectors because their associated multipliers λ2 and λ3 are non-zero (0<λ2=2/125<C=+∞, 0<λ3=2/125<C=+∞). Your attention please, that weight vector W is depicted as an arrow indicates mainly its direction. The scale of weight vector

in fig. 8 is very small.

Derived from the above classifier , the classification rule is:

Now we apply classification rule

into document classification. Suppose the numbers of times that terms "computer" and "derivative" occur in document D are 40 and 10, respectively. We need to determine which class document D=(40, 10) is belongs to. We have:

Hence, it is easy to infer that document D belongs to class "computer science" (yi = –1).

4. Conclusion

In general, the main ideology of SVM is to determine the separating hyperplane that maximizes the margin between two classes of training data. Based on theory of optimization, such optimal hyperplane is specified by the weight vector W* and the bias b* which are solutions of constrained optimization problem. It is proved that there always exist these solutions but the main issue of SVM is how to find out them when the constrained optimization problem is transformed into quadratic programming (QP) problem. SMO which is the most effective algorithm divides the whole QP problem into many smallest optimization problems. Each smallest optimization problem focuses on optimizing two joint multipliers. It is possible to state that SMO is the best implementation version of the "architecture" SVM.

SVM is extended by concept of kernel function. The dot product in separating hyperplane equation is the simplest kernel function. Kernel function is useful in case of requirement of data transformation [1, p. 21]. There are many pre-defined kernel functions available for SVM. Readers are recommended to research more about kernel functions [10].


References

  1. M. Law, "A Simple Introduction to Support Vector Machines," 2006.
  2. Wikibooks, "Support Vector Machines," Wikimedia Foundation, 1 January 2008. [Online]. Available: http://en.wikibooks.org/wiki/Support_Vector_Machines. [Accessed 2008].
  3. V. G. Honavar, "Sequential Minimal Optimization for SVM," Vasant Honavar homepage, Ames, Iowa, USA.
  4. S. Boyd and L. Vandenberghe, Convex Optimization, New York, NY: Cambridge University Press, 2009, p. 716.
  5. Wikipedia, "Karush–Kuhn–Tucker conditions," Wikimedia Foundation, 4 August 2014. [Online]. Available: http://en.wikipedia.org/wiki/Karush–Kuhn–Tucker_conditions. [Accessed 16 November 2014].
  6. Y.-B. Jia, "Lagrange Multipliers," 2013.
  7. J. C. Platt, "Sequential Minimal Optimization: A Fast Algorithm for Training Support Vector Machines," Microsoft Research, 1998.
  8. A. W. Moore, "Support Vector Machines," Available at http://www. cs. cmu. edu/~awm/tutorials, 2001.
  9. I. Johansen, Graph software, GNU General Public License, 2012. G. Eason, B. Noble, and I. N. Sneddon, "On certain integrals of Lipschitz-Hankel type involving products of Bessel functions," Phil. Trans. Roy. Soc. London, vol. A247, pp. 529–551, April 1955. (References).
  10. N. Cristianini, "Support Vector and Kernel Machines," in The 28th International Conference on Machine Learning (ICML), Bellevue, Washington, USA, 2001.

Article Tools
  Abstract
  PDF(1419K)
Follow on us
ADDRESS
Science Publishing Group
548 FASHION AVENUE
NEW YORK, NY 10018
U.S.A.
Tel: (001)347-688-8931