code: public double getCohensKappa()
      {
          // compute p (which is actually accuracy)
          double p = getAccuracy();
  
          //		System.out.println(p);
  
          // compute pe
          double pe = 0;
          for (String label : this.allGoldLabels) {
              double row = getRowSum(label);
              double col = getColSum(label);
  
              //			System.out.println("Label " + label + ", sumCol: " + col + ", sumRow: " + row);
  
              pe += (row * col) / getTotalSum();
          }
  
          pe = pe / getTotalSum();
  
          return (p - pe) / (1 - pe);
      }
docs: Computes Cohen's Kappa
  
  @return double