public void regularize(Vector instance) { if (updateSteps == null || isSealed()) { return; } // anneal learning rate double learningRate = currentLearningRate(); // here we lazily apply the prior to make up for our neglect for (int i = 0; i < numCategories - 1; i++) { for (Element updateLocation : instance.nonZeroes()) { int j = updateLocation.index(); double missingUpdates = getStep() - updateSteps.get(j); if (missingUpdates > 0) { double rate = getLambda() * learningRate * perTermLearningRate(j); double newValue = prior.age(beta.get(i, j), missingUpdates, rate); beta.set(i, j, newValue); updateSteps.set(j, getStep()); } } } }
public void regularize(Vector instance) { if (updateSteps == null || isSealed()) { return; } // anneal learning rate double learningRate = currentLearningRate(); // here we lazily apply the prior to make up for our neglect for (int i = 0; i < numCategories - 1; i++) { for (Element updateLocation : instance.nonZeroes()) { int j = updateLocation.index(); double missingUpdates = getStep() - updateSteps.get(j); if (missingUpdates > 0) { double rate = getLambda() * learningRate * perTermLearningRate(j); double newValue = prior.age(beta.get(i, j), missingUpdates, rate); beta.set(i, j, newValue); updateSteps.set(j, getStep()); } } } }
public void regularize(Vector instance) { if (updateSteps == null || isSealed()) { return; } // anneal learning rate double learningRate = currentLearningRate(); // here we lazily apply the prior to make up for our neglect for (int i = 0; i < numCategories - 1; i++) { for (Element updateLocation : instance.nonZeroes()) { int j = updateLocation.index(); double missingUpdates = getStep() - updateSteps.get(j); if (missingUpdates > 0) { double rate = getLambda() * learningRate * perTermLearningRate(j); double newValue = prior.age(beta.get(i, j), missingUpdates, rate); beta.set(i, j, newValue); updateSteps.set(j, getStep()); } } } }