Note: This post won’t make sense unless you’re steeped in recent machine learning. There’s a good chance that if you are, you already know this.
During a machine learning reading group with Mike Collins, Jenny Finkel, Alexander Rush and myself were reading a paper about confidence-weighted (CW) learning. At a very high-level, CW is a online learning approach: you make updates to parameters after observing a labeled examples . Online methods have enjoyed a lot of popularity recently: the margin infused relaxation algorithm (MIRA) and Primal Estimated sub-GrAdient SOlver for SVM (PEGASOS). These techniques are much simpler and faster to converge than their batch counterparts; the performance gap is or has become negligible (although there might be folks who disagree).
One thing we wanted to understand better is how this approach is different from MIRA. One obvious difference which the authors push is that they’re capturing variance of individual features as well as between features which yields stronger performance. Those are all valid points. But if we strip the feature covariance out of the picture how does the update optimization problem differ? The answer, I think, is that they’re essentially equivalent modulo one subtle difference which is probably important. This is probably obvious to machine learning gurus, but it took me a few minutes to work out. I’m sure this observation is even spelled out in one of the CW papers.
MIRA: Here’s the variant of MIRA I’m working with. You have a current weight vector and you want to update to a new weight vector based on a new example pair :
Here is typically a fixed constant and the above update is done only when an error is made .
CW: In contrast, CW doesn’t have a single weight vector, it has distribution over weight vectors . In normal CW, you get the covariance matrix as parameters. Here, I’m considering a variant where the covariance matrix is fixed to be the identity. The only parameters I’m considering here are the mean weight vector . The update optimization for CW in this context is given by:
The is the Kullback-Liebler Divergence. If you take a look at the expression for the KL diverence between two gaussians, here, it’s pretty straightforward to see that if the covariance matrices are the identity, the KL divergence is within a constant of .
Now for the constraint. The first thing to notice is that . So if is a zero-mean unit-variance gaussian, we want
If is the cumulative distribution function for the unit-normal, we want:
where is the error function.
Here’s the subtlety: If we assume that our feature vectors are normalized and that for any two that and don’t overlap in non-zero features (which is common in NLP since weight vectors are partitioned for different s) then is a constant independent of the particular update. In which case, ensuring (assuming ) just amounts to making sure exceeds some constant independent of the particular update, which is equivalent to selecting that choice of in MIRA. So the two optimizations are essentially the same.
However, if feature vectors are not normalized, then the two aren’t equivalent. Essentially, the larger the feature vector norm the larger the “gap” term needs to be. If you have exclusively binary features, which many NLP applications do, this means the more features active in a datum, the larger “gap” () we require. This makes a lot of sense. We can get this in MIRA pretty straightforwardly:
then it’s always equivalent modulo constant choices. I don’t actually know if the scaling improves accuracy, but I wouldn’t be surprised if it did.