code: public static final double accuracy(SummaryConfusionMatrix m) {
      final double total = m.sumOfallCells();
      double matching = 0.0;
      for (final Symbol key : Sets.intersection(m.leftLabels(), m.rightLabels())) {
        matching += m.cell(key, key);
      }
      return DoubleUtils.XOverYOrZero(matching, total);
    }
docs: Returns accuracy, which is defined as the sum of the cells of the form (X,X) over the sum of
  all cells.  If the sum is 0, 0 is returned.  To pretty-print this you probably want to multiply
  by 100.