@Override public Vector apply(String groupKey, int actual, Vector instance, AbstractVectorClassifier classifier) { if (random.nextDouble() < alpha) { // one option is to apply a ranking update relative to our recent history if (!hasZero || !hasOne) { throw new IllegalStateException(); } return rank.apply(groupKey, actual, instance, classifier); } else { hasZero |= actual == 0; hasOne |= actual == 1; // the other option is a normal update, but we have to update our history on the way rank.addToHistory(actual, instance); return basic.apply(groupKey, actual, instance, classifier); } } }
@Override public Vector apply(String groupKey, int actual, Vector instance, AbstractVectorClassifier classifier) { if (random.nextDouble() < alpha) { // one option is to apply a ranking update relative to our recent history if (!hasZero || !hasOne) { throw new IllegalStateException(); } return rank.apply(groupKey, actual, instance, classifier); } else { hasZero |= actual == 0; hasOne |= actual == 1; // the other option is a normal update, but we have to update our history on the way rank.addToHistory(actual, instance); return basic.apply(groupKey, actual, instance, classifier); } } }
@Override public Vector apply(String groupKey, int actual, Vector instance, AbstractVectorClassifier classifier) { if (random.nextDouble() < alpha) { // one option is to apply a ranking update relative to our recent history if (!hasZero || !hasOne) { throw new IllegalStateException(); } return rank.apply(groupKey, actual, instance, classifier); } else { hasZero |= actual == 0; hasOne |= actual == 1; // the other option is a normal update, but we have to update our history on the way rank.addToHistory(actual, instance); return basic.apply(groupKey, actual, instance, classifier); } } }