@Override
public Balancing constructBalancing() {
if (options instanceof TrainOptionsImpl) {
TrainOptionsImpl trainOpts = (TrainOptionsImpl) options;
if (trainOpts.useDownsampling) {
return new DownsampleBalancing(trainOpts.falsePositiveCost, trainOpts.falseNegativeCost);
} else if (trainOpts.useUpsampling) {
return new UpsampleBalancing(trainOpts.falsePositiveCost, trainOpts.falseNegativeCost);
} else {
return null;
}