double loss = 0d;
for (Tuple<DoubleVector, DoubleVector> dx : data) {
DoubleVector prediction = reg.predict(dx.getFirst());
prediction = new DenseDoubleVector(
prediction.apply(new DoubleVectorFunction() {
@Override
public double calculate(int index, double value) {
return value > 0.5 ? 1d : 0d;
}