xnorm = getNorm(x)*xscale*xscale;
// Calculate loss based on L2 regularization
double loss = totalValue + 0.5 * xnorm * lambda * totalSamples;
say(String.valueOf(numBatches));
say("[" + ( total.report() )/1000.0 + " s " );
say("{" + (current.restart()/1000.0) + " s}] ");
sayln(" "+lastValue + " " + totalValue + " " + loss);
if (iters >= maxIterations) {
sayln("Stochastic Optimization complete. Stopped after max iterations");
break;