@Override
 public double value(final Vec x) {
   final Mx predictMx = (Mx) x;
   int count = 0;
   for (int i = 0; i < predictMx.rows(); i++) {
     if (VecTools.distance(predictMx.row(i), targets.row(i)) < MathTools.EPSILON) {
       count++;
     }
   }
   return (double) count / targets.rows();
 }
 public CMLMetricOptimization(
     final VecDataSet ds,
     final BlockwiseMLLLogit target,
     final Mx S,
     final double c,
     final double step) {
   this.ds = ds;
   this.target = target;
   this.step = step;
   this.classesIdxs = MCTools.splitClassesIdxs(target.labels());
   this.laplacian = VecTools.copy(S);
   VecTools.scale(laplacian, -1.0);
   for (int i = 0; i < laplacian.rows(); i++) {
     final double diagElem = VecTools.sum(S.row(i));
     laplacian.adjust(i, i, diagElem);
   }
   this.c = c;
 }