com.expleague.ml.methods.greedyMergeOptimization.RegularizedLossComparator Maven / Gradle / Ivy
package com.expleague.ml.methods.greedyMergeOptimization;
import java.util.Comparator;
/**
* Created by noxoomo on 30/11/14.
*/
public class RegularizedLossComparator> implements ModelComparators {
Loss loss;
public RegularizedLossComparator(final Loss loss) {
this.loss = loss;
}
@Override
public Comparator regularizationComparator() {
return new Comparator() {
@Override
public int compare(final Model left, final Model right) {
return Double.compare(loss.regularization(left), loss.regularization(right));
}
};
}
@Override
public Comparator targetComparator() {
return new Comparator() {
@Override
public int compare(final Model left, final Model right) {
return Double.compare(loss.target(left), loss.target(right));
}
};
}
@Override
public Comparator scoreComparator() {
return new Comparator() {
@Override
public int compare(final Model left, final Model right) {
return Double.compare(loss.score(left), loss.score(right));
}
};
}
}