Docsity

Combining SVM with Graphical Models for Supervised Classifications | CS 714, Papers of Computer Science

Toggle sidebar
bg1
Combining SVM with graphical models for
supervised classification: an introduction to
Max-Margin Markov Networks
Simon Lacoste-Julien†
†Department of EECS
University of California, Berkeley
Berkeley, CA 94720-1770
slacoste `a eecs.berkeley.edu
December 1, 2003
Abstract
The goal of this paper is to present a survey of the concepts needed to under-
stand the novel Max-Margin Markov Networks (M3-net) framework, a new formalism
invented by Taskar, Guestrin and Koller [TGK03] which combines both the advantages
of the graphical models and the Support Vector Machines (SVMs) to solve the problem
of multi-label multi-class supervised classification. We will compare generative models,
discriminative graphical models and SVMs for this task, introducing the basic concepts
at the same time, leading at the end to a presentation of the M3-net paper.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Combining SVM with Graphical Models for Supervised Classifications | CS 714 and more Papers Computer Science in PDF only on Docsity!

Combining SVM with graphical models for

supervised classification: an introduction to

Max-Margin Markov Networks

Simon Lacoste-Julien†

†Department of EECS

University of California, Berkeley

Berkeley, CA 94720-

slacoste `a eecs.berkeley.edu

December 1, 2003

Abstract The goal of this paper is to present a survey of the concepts needed to under- stand the novel Max-Margin Markov Networks (M^3 -net) framework, a new formalism invented by Taskar, Guestrin and Koller [TGK03] which combines both the advantages of the graphical models and the Support Vector Machines (SVMs) to solve the problem of multi-label multi-class supervised classification. We will compare generative models, discriminative graphical models and SVMs for this task, introducing the basic concepts at the same time, leading at the end to a presentation of the M^3 -net paper.

Contents

1 Introduction 2

2 Setting for multi-label multi-class classification 4 2.1 Example: Part-of-speech tagging........................ 4 2.2 Loss function and risk.............................. 5 2.3 Computational Learning Theory......................... 6

3 Generative method 6 3.1 HMM example.................................. 7 3.2 Analysis...................................... 8

4 Discriminative Graphical Model 8 4.1 Features in Graphical Models.......................... 8 4.2 Conditional Random Fields (CRF)....................... 9 4.3 Analysis...................................... 11

5 Introduction to Support Vector Machines (SVM) 11 5.1 Max-margin linear classifier........................... 11 5.2 Lagrangian duality................................ 13 5.3 SVM dual and the Kernel trick......................... 15

6 Multi-class SVM 17 6.1 Analysis...................................... 19

7 Max-Margin Markov Networks (M^3 net) 19 7.1 Margin-based Structured Classification..................... 19 7.2 Key insight to obtain the factored dual..................... 20 7.3 General graphs and other issues......................... 22 7.4 Analysis and other related papers........................ 22

8 Conclusion 23

1 Introduction

In supervised classification learning, the goal is to learn a function which assigns (discrete) labels to arbitrary objects, given a set of already assigned independent instances. This framework has a vast number of applications ranging from part-of-speech tagging to optical character recognition. In the past years, the state-of-the-art algorithm for this task has been the Support Vector Machines (SVMs) [CV95, Vap99], an algorithm based on the maximiza- tion of the margin of confidence of the classifier (where the margin is related to the minimal distance between the points and the classifier in some Euclidean space). Their success was due to their ability to use very high dimensional feature spaces (using the kernel trick) while

to extend SVMs to the multi-class problem. Finally, we present the M^3 -net framework in section 7, which reunites all the ideas of the preceding sections.

2 Setting for multi-label multi-class classification

We are interested in multi-label multi-class classification, that is, to a classification problem where each label can take a finite number of values (multi-class), and where each (structured) object can take a finite number of labels (multi-label). Thus the goal is to learn a function (hypothesis) h : X → Y, where X is the set of (structured) objects (also called patterns) that we want to classify with l labels, and where Y = Y 1 ×... × Yl is the set of (structured) labels (which is structured here as a vector of labels without loss of generality). In this paper, we will assume for simplicity that each Yi has the same form, namely, Yi = {y 1 ,... , yk}, for some fixed k. The training of the classifier is made with a sample set S of n iid labelled instances: S =

x(i), y(i)^ , t(x(i))

)}n i=

where x ∈ X and y = (y 1 , ..., yk) ∈ Y, and where S is assumed to be drawn from a fixed distribution DX ×Y. Notice the use of the superscript to index the different training instances, and the subscript to index the components of the joint label. Also, we use the notation t(x(i)) for the target value of x(i)^ so that we can distinguish it with other (arbitrary) values for y later. This is not necessary when doing binary classification, but will be a real notation convenience when dealing with M^3 -nets...

2.1 Example: Part-of-speech tagging

As a concrete example which will be used in the sequel, we look at the problem of labelling a FAQ database as was presented in [MFP00]. An example of a labelled FAQ instance was the following:

X-NNTP-Poster: NewsHound v1. Archive-name: acorn/faq/part Frequency: monthly 2.6) What configuration of serial cable should I use Here follows a diagram of the necessary connections programs to work properly. They are as far as I know t

Here, each x = (x 1 ,... , xl) is a sequence of sentences; and each sentence xi is labelled by yi ∈ Y = {head, question, answer, tail}. In this case, the data is inherently sequential and it is clear that the label of a sentence doesn’t only depend on its words but also on what

happened in the previous sentences. For example, the empty line is labelled sometimes as ‘head’ and other times as ‘question’ in this excerpt. Other examples of structured data classification are:

collective webpage classification where interlinked webpages are to be labelled collec- tively [TAK02];

named entity recognition where the goal is to find and identify named entities (like named organizations, persons, organizations, as well as temporal and monetary ex- pressions) in a segmented text (and so there is a special ‘none’ label when a word is not a named entity) [BSW99];

handwritten word recognition where characters are individually labelled inside a word [TGK03];

Thomas Dietterich gives a review of sequential data classification in machine learning in [Die02].

2.2 Loss function and risk

We need some way to evaluate the performance of the classifier. A useful tool is the loss function^3 L : X × Y × Y → [0, ∞[, where L(x, y, h(x)) gives the cost of assigning the label h(x) to the observation x given that the correct label is y [SS02, ch 3]. It is usually assumed that L(x, y, y) = 0 so that the minimal value is 0 and attained by the correct labelling. In a decision theoretic framework, the loss function is a negative utility function. A rational goal then would be to minimize the total loss on the labels to be predicted. In the case where one doesn’t know which objects it will have to classify in the future, it makes sense to minimize the expected loss on future data, called the expected risk R[h] which is a functional of the classifier h:

R[h] ,

X ×Y

L(x, y, h(x)) dD(x, y) (2)

Since we don’t know D, it is not possible in general to compute the expected risk. One has to turn to approximations. A useful one, motivated by the Glivenko-Cantelli theorem^4 , is to compute the empirical risk Remp[h], evaluated on the sample S of size n:

Remp[h] ,

n

∑^ n

i=

L

x(i), t(x(i)), h(x(i))

Vapnik discusses in [Vap99] how we can generalize the law of large numbers in function space (with very strict conditions) to tell us when working with Remp[h] will be a good approximation to R[h].

(^3) Also called cost function [Die02]. (^4) which says that the sequence of empirical distribution functions for iid samples of size n converge uniformly to the true distribution function as the sample size n goes to infinity (see [Dur96]).

Figure 1: (naive) HMM graphical model for the FAQ problem. The definition of xi and yi is given in section 2.1. The labels are hidden variables in the context of classification. For the training part, all the nodes are observed (and we will have n iid copies of this graph).

hand. Using the training data, the hope is that if the modelling assumptions are good, one will be able to find a parameter w which yields a good approximation to the real dis- tribution D. Then to do classification, one can choose the most likely label by computing hw(x) = arg maxy P (y|x, w), which can be efficiently computed using the Viterbi algo- rithm [Jor03] on the graphical model (even if there is an exponential number of labels - that is one of the great advantages of graphical models over SVMs).

3.1 HMM example

To illustrate the idea, we will come back to our FAQ database tagging example (see sec- tion 2.1) and use a Hidden Markov Model (HMM). We will restrict our attention in this paper to sequential data to simplify the notation, but we will discuss in section 7.3 how the ideas can also be applied to arbitrary graphs. HMMs have been widely used in part-of-speech tagging, amongst others, and a classical tutorial is given by Rabiner in [Rab89]. Figure 1 shows the HMM for the FAQ database problem. We can already see that we have made the incorrect assumption that the line content was conditionally independent of the other labels given its line label. This is wrong here since for example the blank line has a much higher probability of happening for a line labelled ‘answer’ which was preceded by a ‘question’ than for a line which was preceded by another ‘answer’. But we remind the reader that the point here is not to construct an accurate model but rather to illustrate the different concepts. With this model, the joint is thus:

P (x, y) = P (y 1 )

∏^ l−^1

i=

P (yi+1|yi)

∏^ l

i=

P (xi|yi) (5)

where the implicit dependence on w was not shown in the notation (and we will keep this convention for the remaining of the paper; each time there is a probability function or a potential, it is assumed that it depends implicitly on a parameter w). The parameterization

of P (yi+1|yi) is usually a matrix; and P (xi|yi) 6 would normally (in the part-of-speech tagging community) be a multinomial over a finite vocabulary, though here it would be intractable since the number of possible sentences is pretty large... This indicates another disadvantage of using the generative approach (we’ll see in section 4.1 how a ‘feature’ approach can solve partly this problem). The training can be made (efficiently) using a maximum likelihood (ML) estimate which decomposes nicely here since all the nodes are observed (we don’t need to use EM). Once the model has been fitted on the training data, one can do classification by computing hw(x) = arg max y P (y|x, w) (6)

using the fact that P (y|x) ∝ P (x, y) for fixed x.

3.2 Analysis

As mentioned in [Jor03, ch 7], the generative approach can be efficient when we have accurate prior knowledge of the true data-generating process D. On the other hand, it is suboptimal in some sense since it tries to estimate accurately the joint P (x, y) when all we really need for classification is P (y|x), or rather its maximum argument. The discriminative approach, in comparison, models directly P (y|x) without any assumptions of what are the interactions inside x, which are not needed in classification since x is given. This gives a more robust approach since it uses weaker assumptions about the distribution. It is also well suited for a feature-based approach, which we will present in the next section.

4 Discriminative Graphical Model

4.1 Features in Graphical Models

The usual definition of undirected graphical models uses arbitrary potentials on maximal cliques. But as mentioned in [Jor03, ch 19], “large, fully-parameterized cliques are prob- lematic both for computational reasons (inference is exponential in the clique sizes) and for statistical reasons (the estimation of large numbers of parameters requires large amounts of data)”. In practice, one will thus want to use a reduced parameterization for the clique potentials. One way to do that is to use a feature approach with models in the exponential family. For a given clique C (using the notation from [Jor03]), we define a set of (fixed) features fi(xCi ) where Ci ⊆ C is a subset of the variables that the feature fi references and where fi is an arbitrary real-valued function (though it is usually an indicator function). The parameterized clique potential with parameter w is then written:

ψC (xC ) , exp

j∈IC

wj fj (xCj )

where IC is the index set for the features for the clique C. We thus see that the features act as the sufficient statistics in the exponential family representation (see [Jor03, ch 8]).

(^6) called the class conditional (see [Jor03, ch 5,7]).

framework is well-suited to model the FAQ tagging problem, and that’s why in fact we chose this example^7. With this graphical model, the conditional P (y|x) is then:

P (y|x) =

Z(x)

∏^ l−^1

i=

ψ(yi, yi+1, x)

∏^ l

i=

ψ(yi, x) (8)

where Z(x) is a normalization constant which depends on x. It is now worthwhile to study the form of this conditional more in details. It was assumed in the example in [LMP01] that the potentials were homogeneous along the chain and similarly in the M^3 -net paper [TGK03], so we will use the same simplifying assumption. Now define the feature vector Fi(x, yi, yi+1) as:

Fi(x, yi, yi+1) , (f 1 (yi, yi+1, x),... , fd 1 (yi, yi+1, x), g 1 (yi, x),... , gd 2 (yi, x))T^ ∈ Rd^1 +d^2 (9)

and also (for notational convenience in the boundary case):

Fl(x, yl, yl+1) , (0,... , 0 , g 1 (yl, x),... , gd 2 (yl, x))T^ ∈ Rd^1 +d^2 (10)

then we define the joint feature vector

F(x, y) ,

∑^ l

i=

Fi(x, yi, yi+1) (11)

With this notation, we can now easily see that the conditional is:

P (y|x) ∝ exp

wT^ F(x, y)

with w = (λ 1 ,... , λd 1 , μ 1 ,... , μd 2 )T^ and thus is a softmax function. It was mentioned in [Jor03, ch 7] that generative models with class-conditionals and marginals in the ex- ponential family yielded the softmax function for P (y|x) in general and thus we see that the form chosen for the CRF parameterization is very general. The training of a CRF is made as for other completely observed graphical models with Maximum Likelihood. Since the graph is undirected, the ML optimization doesn’t separate in local ML problems like in the directed case because of the presence of the normalization term. The ML solution is found by using Iterative Proportional Fitting (IPF), which is exact in the case where the graph is triangulated (see [Jor03, ch 9]). For feature based graphical models, IPF is called Iterative Scaling and is described in [Jor03, ch 20]. An improved version is described for CRF in [LMP01]. Finally, the classification is made like in the generative case by computing (6).

(^7) This example was taken from a paper on Maximum entropy Markov models (MEMMs) [MFP00], another form of discriminative graphical models which was the ancestor of CRFs.

4.3 Analysis

CRF and other discriminative methods solve the problem of having to model x when it is not needed, and so yield a more robust and efficient algorithm for classification than the generative approach when one doesn’t have good prior knowledge about x. On the other hand, it still can’t handle high dimensional features because the formal- ism manipulates them directly (not like kernel-based methods which will be presented in section 5.3). Moreover, the graphical model formalism doesn’t include the risk formulation that we have presented in section 2.2. There are ways to relate the ML likelihood with the empirical risk by defining the correct loss function (see [SS02, ch 3]), but ML doesn’t include a regularization term and so we can’t obtain bounds on the expected risk like equation 4 (or rather, we haven’t heard of). It was mentioned in [AH03] that sometimes a regularization term is added to the log-likelihood for CRF in order to avoid overfitting the data. We didn’t have the time to study more this approach, but it was claimed in [TGK03] that discrim- inative methods don’t have yet the same generalization guarantees as SVMs. This makes sense since the CRF framework doesn’t take into account the loss function explicitly, which is what we want to optimize during learning. On the other hand, support vector machines make direct use of the bound given in equation (4), yielding nice generalization guarantees. We will now present a brief introduction to its concepts.

5 Introduction to Support Vector Machines (SVM)

5.1 Max-margin linear classifier

The Support Vector Machine (SVM) is a learning algorithm for a linear classifier which tries to maximize the margin of confidence of the classification on the training data set. It was described in [CV95] by Cortes and Vapnik. The classical tutorial paper usually quoted is the one by Burges [Bur98], though it is now starting to get old. A gentle (and modern) introduction is given by Cristianini and Sch¨olkopf in [CS02]; and also in chapter 1 of [SS02]. The detailed story can be found in [Vap99], or in [CST00] at a more introductory level. We will now try to outline quickly the main ideas behind SVMs. We first consider the case where we want to classify x (which is assumed to lie in Rd) amongst two classes in Y = {− 1 , 1 }. A linear classifier will be an hyperplane in Rd^ charac- terized by a normal w and an offset b. The binary classifier can be:

hw(x) = sgn(wT^ x + b). (13)

where sgn is the sign function which will take value 0 at 0, say, so that the classification is ambiguous at this point. If the data is linearly separable, then it is possible to find an hyperplane which will correctly satisfy all the points, that is, a (w, b) such that:

wT^ x(i)^ + b > 0 if t(x(i)) = 1 wT^ x(i)^ + b < 0 if t(x(i)) = − 1

bound on the expected risk (note that here the empirical risk is 0 since we assumed that the data was linearly separable). In fact, a measure of capacity which is defined in [Vap99] is the Vapnik Chervonenkis (VC) dimension for a class of classifiers H. For the 0-1 loss (which is 1 when the label is incorrectly classified and 0 otherwise), the bound Ω(A, n, δ−^1 ) in equation (4) can be written:

( V · (log(2n/V ) + 1) + log(4/δ) n

where V is the VC-dimension of the class of classifiers considered, and n is the size of the sample. This bound is called the VC confidence (see [Bur98]) and we are presenting it here just to give an idea of the kind of dependence on V and n that one can expect. Also, Vapnik derived in [Vap99] an expression for the VC dimension of the class of linear classifiers with specific margin which indicated that bigger margins yielded smaller error bound, thus giving considerable justification for maximizing the margin. Finally, we have to deal with the case when the data is not linearly separable. Then some points x(i)^ can be at a distance ξi/||w|| on the wrong side of the margin hyperplane. We can thus transform the constraint (15) to:

t(x(i)) · (wT^ x(i)^ + b) ≥ 1 − ξi, ξi ≥ 0 ∀i (18)

If x(i)^ is misclassified, then the LHS of (18) is smaller than 0 and thus ξi has to be greater than 1. This means that Cn

∑n i=1 ξi^ is an upper bound on the 0-C average loss on the training data (with a constant C > 0), that is, of Remp[h] for the 0-C loss (a cost of C for each error). Following our goal of structural risk minimization (minimizing the RHS of (4)), we want to minimize the sum of Cn

∑n i=1 ξi^ (which is an upper bound on the empirical risk) and^ ||w||

which is related to Ω(h). The tradeoff between each contribution is encoded by the constant C that the user can choose, with C = ∞ meaning that he can’t tolerate any error (its cost is infinite). Hence, the learning algorithm will find the classifier (w, b) which satisfies the following optimization problem on the training data:

minimize (w, b), ξ

1 2 w

T (^) w + C n

∑n i ξi^ (19)

subject to t(x(i)) · (wT^ x(i)^ + b) ≥ 1 − ξi, ξi ≥ 0 ∀i

In order to solve this constrained optimization problem, we can use the method of Lagrange multipliers. As it is pretty crucial to the sequel, we now present a review of Lagrangian duality.

5.2 Lagrangian duality

The general goal of duality in constrained optimization is twofold: to help to solve the original problem; and to provide a certificate which guarantees that we have found the optimal solution. The second goal is more of an issue in linear programming, though. Boyd

gives a nice treatment of Lagrangian duality in [BV04, ch 5]; and more details can be found in [Ber99]. We will consider here the following (primal) constrained optimization problem:

minimize f (x) (20) subject to fi(x) ≥ 0 , i = 1,... , n

where x ∈ X for some arbitrary set X. Call p∗^ the (global) solution to this problem.^8 We introduce the Lagrangian function L(x, α) with non-negative Lagrangian multipliers αi (also called dual variables):

L(x, α) , f (x) −

∑^ n

i=

αifi(x) (21)

For a feasible point x, fi(x) ≥ 0 and since αi ≥ 0 then we have that L(x, α) ≤ f (x) ∀x feasible. Thus we have: g(α) , inf x L(x, α) ≤ p∗^ (22)

g(α) is called the dual function and yields a lower bound for the (primal) optimal solution p∗^ for each value of α ≥ 0. To get the best bound, we look at the maximal value d∗^ for the dual function: d∗^ , sup α≥ 0

g(α) = sup α≥ 0

inf x L(x, α) (23)

The (Lagrangian) dual problem is to compute d∗. By equation (22), we have that d∗^ ≤ p∗ (always) which is called weak duality. When the primal problem satisfies certain regularity conditions (e.g. it is convex and has a strictly feasible solution - this is Slater’s condition), then d∗^ = p∗^ and strong duality is said to hold. This means that we can find the minimum value for the primal by maximizing the dual. Moreover, if the dual function can be computed with certainty, then a (saddle) point (α, x) which is feasible and satisfies g(α) = f (x) gives the optimal value as well as a certificate. There are several advantages to look at the dual problem. First of all, g(α) can usually be computed easily since it is obtained from the unconstrained minimization of L(x, α) over x. Moreover, g(α) is always convex as is explained in [BV04], and so it doesn’t have the problem of having many different local minima. In the case where all the functions are differentiable, there is a nice geometrical interpre- tation for the optimal point. Figure 4 explains it (see [Ber99] for more details). If moreover strong duality holds, then the Karush-Kuhn-Tucker (KKT) conditions give sufficient and necessary conditions for (x∗, α∗) to be a saddle point of the Lagrangian (i.e. x∗^ is primal optimal and α∗^ is dual optimal). They are

  • (x∗, α∗) is feasible (i.e. fi(x∗) ≥ 0 and αi ≥ 0);
  • ∇xL(x∗, α∗) = ∇f (x∗) −

∑n i=1 αi∇fi(x

∗) = 0 (this is a generalization of what figure 4 showed but with more than one constraint); (^8) By convention, p∗ (^) = −∞ if the feasible solutions are unbounded below and p∗ (^) = ∞ if there is no feasible

solution. But we won’t go into those details.

The two other partials of L with respect to ξ and b yield the constraints^9

∂L ∂ξi

= 0 ⇒ αi =

C

n

− βi (26)

∂L ∂b

∑^ n

i=

t(x(i))αi = 0. (27)

Substituting this solution back in (24), we get the dual function:

g(α, β) =

∑^ n

i

αi −

∑^ n

i

∑n

j

t(x(i))t(x(j))αiαj (x(i)^ • x(j)) (28)

Since βi doesn’t appear in the objective function, we can combine the constraints (26) and (27) together (with βi ≥ 0) to obtain the equivalent constraint C/n ≥ αi ≥ 0. Since the primal problem was convex and strictly feasible, we can find its solution by equivalently solving the dual problem (by strong duality):

maximizeα

∑n i αi^ −^

1 2

∑n i

∑n j t(x

(i))t(x(j))α iαj (x (i) (^) • x(j))

subject to

∑n i t(x

(i))αi = 0 (29) C n ≥^ αi^ ≥^0 ∀i

The optimal classifier is then given by:

hα(x) = sgn

( (^) n ∑

i=

t(x(i))αi(x(i)^ • x)

The change of formulation from the primal to the dual has two advantages. First of all, we obtained a quadratic program (29) that generic packages can solve (the primal was also a QP though its structure was slightly more complicated). There is even a simple special purpose algorithm for this formulation called Sequential Minimal Optimization (SMO) which simply does coordinate ascent in the objective function by solving analytically the optimization problems with all variables fixed except a pair (see [CST00, ch 7]). The other advantage, which is even more remarkable, is that the data only enters in the formulation as dot products. This is a tremendous advantage since this means that we don’t need to keep track of the individual components of the vectors; all we need is how they dot themselves with the other vectors. The crucial point is that dot product in submanifolds of space of very high dimensions can be carried out efficiently (if the submanifold has small enough intrinsic dimension). We can thus map our input vector x to a feature space H with a feature map x 7 → F(x) ∈ H where H can be very high dimensional (even infinite dimensional). This mapping is called the kernel trick. The dot product in the new space is

(^9) Strictly speaking, the Lagrangian is linear in ξ and b and so is unbounded unless its derivative with respect to those variables is zero. So formally, the dual function takes value −∞ for values of ξ and b for which the slope is not zero.

given by a kernel function k(x, x′) = F(x) • F(x′) which can be computed in the original space. As an example of kernel, consider the kernel

k(x, x′) = (x • x′)^2 =

( (^) n ∑

i=

xix′ i

∑^ n

i=

∑^ n

j=

xixj x′ ix′ j

( ∑n,n)

(i,j)=(1,1)

(xixj )(x′ ix′ j ) = F(x) • F(x′)

if F(x) = (xixj )((n,ni,j)=(1) ,1) is the feature map, which amounts to map the original vector x

to all its monomials of degree 2 (and thus a space of dimension

(n+ 2

). The kernel can be computed in linear time, even if the feature space has a quadratic number of coordinates. Similarly, we can show that the kernel k(x, x′) = (x • x′)d^ amounts to map a vector to all its monomials of degree d (there are

(n+d− 1 d

of them!). The advantage of mapping the data to high dimensional feature space is that a linear boundary in the feature space can correspond to an arbitrary non-linear boundary in the original space. SVM with the kernel trick can thus learn a very rich class of functions. But because of the strict max-margin criterion for the choice of classifier, it still doesn’t suffer from the curse of dimensionality. The kernel computes the distance in the feature space and is thus a measure of dissim- ilarity. The design of kernels which represent well the underlying interactions has become an art. They can be created by starting first from a feature map; or by defining the kernel directly; or by constructing it from other kernels.

6 Multi-class SVM

Now that we have seen how SVMs can be used to do binary classification, we have to consider how they are adapted to do multiway classification. The approach which is often used (and works well in practice) is to simply train k binary classifier (independently) which will each learn to recognize one class vs. the rest (and is thus called the one versus the rest approach [SS02, ch 7]). Then the winner class can be chosen with

h(x) = arg max j∈{ 1 ,...,k}

wˆTj x + bj (31)

where each ( ˆwTj , bj ) is the hyperplane for the class j and ˆwj is normalized. This classifier amounts to choose the class of which its binary hyperplane is the farthest (in signed Euclidean distance) from the point that one wants to classify. This makes sense since the farther from the plane it is, the more confidence you have in the classification. Figure 5 gives an example of multiway classification using one vs. rest hyperplanes.

Figure 6: SVM model for the FAQ problem. The labels are assumed to be independent.

6.1 Analysis

The advantages of the SVM approach is the possibility to use high dimensional feature spaces (using the kernel trick). For the FAQ tagging problem, one could use very rich feature functions of the sentences, richer than in the CRF model. Also, the max-margin approach gives theoretical bound on the generalization error. On the other hand, the SVM here doesn’t exploit the structure of the labels, which was found to be crucial in this case as explained in section 3.1. This last part is what the M^3 -net formalism will solve.

7 Max-Margin Markov Networks (M^3 net)

7.1 Margin-based Structured Classification

The M^3 -net uses a CRF to parameterize in a factored way the conditional distribution P (y|x), i.e. P (y|x) ∝ exp

wT^ F(x, y)

exactly like in (12) and with the feature vectors defined in (11). wT^ F(x, y) is called the dis- criminant function, and can be seen as the measure of compatibility between the observation sequence x and the joint label y [AH03]. The corresponding classifier is thus

hw(x) = arg max y wT^ F(x, y) (34)

We now want to include some kind of max-margin argument in the training part and thus we don’t use the usual Maximum Likelihood estimate for CRF. Like we had discussed before, we are not interested in the exact form of P (y|x), we are rather interested in the classifier arg maxy wT^ F(x, y) and with what confidence the classification is done. Note that in the single label case, we can recover equation (32) from (34) by defining w = (wT 1 , ...wTk )T^ and F(x, j) = (0, 0 , 0 ,... , xTj , 0 , 0 ,... , 0)T^ and augmenting x by the constant coordinate one to obtain homogeneous coordinates.

A suitable notion of margin in this case is the difference between the value of the dis- criminant for the true label with the value of the best runner up. If the data is linearly separable, we can rescale w so that the minimal difference is 1 (similar to equation (15)). The respected margin constraint is thus:

wT^ F(x, t(x)) ≥ 1 + wT^ F(x, y), ∀y 6 = t(x), ∀x ∈ S (35)

and we see here the convenience of having defined the target function t(x). Again, for the case of non-separable data, we introduce the non-negative slack variables ξx (one for each element of the sample). We also define ∆Fx(y) = F(x, t(x))−F(x, y) for brevity of notation. The constraint (36) then becomes:

wT^ ∆Fx(y) ≥ 1 − ξx, ∀y 6 = t(x), ∀x ∈ S (36)

Finally, Taskar et al. in [TGK03] suggests the use of a margin which should be proportional to the number of individual errors ∆tx(y) ,

∑l i=1 I^ {yi^6 = (t(x))i}^ made inside a label. This amounts to define a loss function which is proportional to the number of individual label errors (with constant of proportionality C). Similarly as for the binary SVM case, we will then have that Cn

x∈S ξx^ will be an upper bound for the empirical risk according to this loss function. With all those modifications, the max-margin framework for M^3 -net thus becomes:

minimize w, ξ

wT^ w 2 +^

C n

x∈S ξx^ (37) subject to wT^ ∆Fx(y) ≥ ∆tx(y) − ξx, ∀x ∈ S, ∀y

Note that the constraint ξx ≥ 0 is included by the case when y = t(x). As in the usual SVM approach that we have described in section 5.3, we can derive the dual formulation of this problem by minimizing the Lagrangian with respect to w and ξx and then substituting back the solution to get the dual objective function to maximize. Here, there was one constraint for each x ∈ S and y and so we introduce the dual variables αx(y). The derivations are pretty similar to the standard case, and so we only quote the result:

maximize αx(y)

x,y αx(y)∆tx(y)^ −^

1 2

x,y

x′,y′^ αx(y)αx′^ (y

′)(∆Fx(y) • ∆Fx′ (y′)) (38)

subject to

y αx(y) =^ n

− (^1) C, ∀x ∈ S; αx(y) ≥ 0 ∀x ∈ S, ∀y

Up to this point, there was not much anything new. This derivation was an almost exact adaptation of the formulation of Crammer and Singer given in [CS01], but for the multi-label case. The result here is an optimization problem with an exponential number of variables and constraints, and thus doesn’t seem to be practical.

7.2 Key insight to obtain the factored dual

But we haven’t used the fact yet that we had sparse correlations in the feature representation. How can we do that? The key insight was to notice, like was already mentioned in [CS01] for