

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Machine Learning (CS 5350/CS 6350) 08 Mar 2007
Structured Perceptron
Remember the CRF... We had the following basic algorithm for optimization:
This is a general theme for structured prediction models. Other algorithms (that we don’t discuss) such as max-margin Markov networks, structured SVMs, etc., all embody this basic premise, but with slightly different parentheticals on step (2).
The problem with CRFs is that for most graph structures, step 2 above is intractable. So we’re going to replace it with something more tractable. This leads to the structured perceptron.
(a) For each 1 ≤ n ≤ N : i. Compute predicted output ˆy = argmaxy∈Y w>Φ(xn, y) ii. If ˆy 6 = yn, perform update:
w ← w + Φ(xn, yn) − Φ(xn, yˆ)
iii. (Optional: average weights)
This is just like the perceptron for binary classification, but extended to structured prediction. Note that for sequence labeling problems, we write Φ(∑ xn, yn) for the sum of all features over all substructures: Φ(xn, yn) =
m Φ(xn, yn,m, yn,m−^1 ) for instance.
Note that in comparison to the CRF, we have reduced the requirement of summing over all possible paths (forward-backward) to the requirement of computing the best path (Viterbi). One way of thinking about this is to consider the gradient of the log-likelihood for the CRF:
∇w`(yn | xn) =
m
Φ(xn, yn,m, yn,m− 1 ) −
l,p
p(ym = l, ym− 1 = p)Φ(xn, l, p)
We obtain something that identical to the perceptron update if we assume that a single path—the best path— has all of the probability mass. This is exactly the same relationship we had between logistic regression and the (classification) perceptron from the first part of class.
One question that arises is: what if the argmax isn’t even tractable? The first solution is to use a best-guess y, found using some search process, instead of the argmax. But, in general, we can do better...
Machine Learning (CS 5350/CS 6350) 2
Search-based Structured Prediction
A problem near to my heart in machine translation: given an Arabic sentence a, find the best possible English translation e. I.e., for some scoring function f , for an input a, find ˆe = argmaxe f (e, a). In general, this will require considering a gigantic number of possible e: even for a dumbed down model, the problem is NP-hard. This is the case for many problems in many domains (eg. biology). An additional problem is that the loss functions we care about are complex.
So, what do we do in practice when we want to solve an NP-hard problem? We use an approximate search technique (or approximation algorithm, but they’re usually pretty similar).
Search(a, f ):
(a) Remove h, the top scoring partial hypothesis from Q (b) If h represents a complete hypothesis, return it (c) For all possible ways of extending h 7 → h′, i. Compute a score s′^ = f (a, h′) ii. Add h′^ to Q with score s′ (d) If Q is too large, drop some low-scoring elements from it.
In the translation example, we may consider a left-to-right search over e. In each “extension” step, we add a single word to e. The score will then depend on: (a) how grammatical is e up to the current position and (b) how well does it reflect a translation of a substring of a?
How can we do learning in such a system? Well, we can compute scores using a learned model. I.e., use s′^ = f (a, h′), where f is a learned function. The remaining question is: how can we learn f based on training data of the form of pairs of inputs and outputs?
What do we want? We want a function f so that (e, Search(a, f )) is as low as possible, where is a loss function. We’re going to do this via reductions. Specifically, we will reduce to cost-sensitive (multiclass) classification (from which we can apply, eg., weighted all pairs and costing).
To simplify the problem, consider greedy search:
GreedySearch(a, f ):
(a) Choose an action we can take from e, f (Φ(a, e)). (b) Update e ← 〈e, a〉
Here, f looks just like a classifier over (features of) actions.
So the question is how can we create training data to train such an f?
Obvious attempt number one: