Take labels and fix the standard normalization in which the squared weight penalty has coefficient . The squared-slack support vector machine, a form of soft-margin support vector machine, has primal problem
The slack variables of a support vector machine permit margin violations. Penalizing favors a wide support-vector-machine margin, while sets the cost of the violations. The intercept is unpenalized, and the resulting classifier is , with a fixed choice at zero. The square on is essential to the Lagrangian dual problem below.
Use Lagrange multipliers for and for . The optimization Lagrangian is
The Lagrange dual function is the infimum over the now unconstrained primal variables. The first-order optimality conditions in and give
If the latter equality fails, the infimum over is . The first-order optimality condition in gives
Substitution, or completing the square separately in and each , produces
provided . For fixed nonnegative , this expression is maximized over at . Thus the simplest Lagrangian dual problem is
In particular, there is no upper box constraint . That constraint belongs to the linear-slack penalty; squared slack instead contributes the displayed diagonal quadratic penalty. With and Gram matrix , the objective can also be written
Since is positive semidefinite and , the matrix in parentheses is positive-definite. The objective of the Lagrangian dual problem is therefore strictly concave, and the feasible maximizer is unique.
The primal problem is a convex optimization problem, and is strictly feasible for both families of inequalities. Slater's condition gives strong duality, so an optimum of the Lagrangian dual problem yields a primal optimum. The Karush-Kuhn-Tucker conditions supply
For any with , the intercept is consequently
All such choices agree at an exact optimum. If all labels have one sign, the optimal coefficients can all be zero: choose , , and any constant intercept of that sign with magnitude at least one.
A real positive-semidefinite kernel on an input set is a function for which there is an inner product space and a feature map satisfying
Equivalently, is symmetric and every finite Gram matrix is positive semidefinite: for all real coefficients . An infinite-dimensional Hilbert space is allowed.
Replace every inner product in part (b) by and solve
This is precisely the Lagrangian dual problem obtained by replacing each original input by in the primal problem. The weight vector it determines is
and the intercept follows from the same Karush-Kuhn-Tucker conditions. For example, if ,
Thus training needs only the finite Gram matrix, even if the feature map has infinitely many coordinates. This is the kernel trick. The result is an affine linear classifier in the feature space; its boundary in the original input space can be nonlinear. The squared-slack diagonal term and the equality constraint remain unchanged.
An embedding is determined by its chosen increasing sequence of positions. Accordingly, the all-subsequence embedding kernel counts pairs of embeddings, one in and one in , that spell the same subsequence. The two embeddings are distinguished even when they spell the same word as another pair. The empty word contributes exactly one pair.
Let , , and define for prefixes. When either prefix is empty, only the empty word has an embedding in both, so
To derive a dynamic programming recurrence, count pairs that do not use position of or do not use position of . Inclusion-exclusion gives
The remaining pairs use both final positions. These positions must be the final letters of the common word, so they contribute nothing if . If , deleting those two final positions is a bijection to arbitrary embedding pairs on the two shorter prefixes, including their empty pair. Their contribution is therefore . Hence
Equivalently, when the final symbols agree the recurrence simplifies to ; when they differ, subtract the diagonal term. Fill the table in increasing prefix order and return . The boundary values and the disjoint counting argument prove correctness by induction on .
A one-row implementation of this dynamic programming uses the saved old diagonal entry:
F[0..p] := 1
for i := 1 to n:
    diagonal := 1
    for j := 1 to p:
        above := F[j]
        if x[i] = y[j]:
            F[j] := above + F[j-1]
        else:
            F[j] := above + F[j-1] - diagonal
        diagonal := above
return F[p]
The assignment to diagonal retains the value from the previous row before F[j] was overwritten. Swapping and if necessary minimizes the row length. Thus the time complexity is arithmetic operations and the extra space complexity is integer cells. Empty inputs return one immediately.
These counts include multiplicity: for , the empty word contributes , the word contributes , and contributes , giving , not three. More generally, each result is at most , since it counts some pairs of position subsets. Exact integers therefore require bits; the stated quadratic bound is an arithmetic-operation bound, with a conservative bound for elementary bit arithmetic.
The proposed positive-semidefinite kernel is valid: for each finite string only finitely many coordinates are nonzero, so is a well-defined feature map into the inner product space of finitely supported coordinate families, and its inner product is exactly .

Articles by others on the same topic (0)

There are currently no matching articles.