(1) For the calculation of the quadratic kappa metric the confusion matrix O i,j and the expected matrix E will be needed. The latter is calculated as the outer product of the two histograms, one coming from the actual labels and the other from the predictions. After normalizing the two matrices, the quadratic kappa value can be calculated as follows using a 3 × 3 weights matrix w with a quadratic distance function.