private void updateW(double[] w, int bestFeature, double alpha,
ArrayList<ClassificationInstance> trainingData) {
double wrongUpdate = Math.exp(alpha);
double correctUpdate = Math.exp(-alpha);
for (int instInd = 0; instInd < trainingData.size(); instInd++) {
ClassificationInstance inst = trainingData.get(instInd);
for (int y = 0; y < yAlphabet.size(); y++) {
SparseVector fv = fxy.apply(inst.x, y);
for (int i = 0; i < fv.numEntries(); i++) {
if (fv.getIndexAt(i) == bestFeature) {
if (y == inst.y)