//Function that takes the computed confusion matrices //and calculates: //Average Accuracy, Average Accuracy per class, Average Recall per class public static Double[,] ProcessStatistics(ConfusionMatrix[,] data) { Double[,] average = new Double[4, 5]; //For each algorithm for (int i = 0; i < 4; i++) { //For each confusion matrix for (int j = 0; j < 5; j++) { //Calculate average[i, 0] += data[i, j].Accuracy; //General accuracy average[i, 1] += data[i, j].PredictedPositives / GetNonZero(data[i, j].ActualPositives + data[i, j].FalsePositives); //Accuracy for class 1 average[i, 2] += data[i, j].PredictedNegatives / GetNonZero(data[i, j].ActualNegatives + data[i, j].FalseNegatives); //Accuracy for class 2 average[i, 3] += data[i, j].TruePositives / GetNonZero(data[i, j].TruePositives + data[i, j].FalseNegatives); //Recall for class 1 average[i, 4] += data[i, j].TrueNegatives / GetNonZero(data[i, j].TrueNegatives + data[i, j].FalsePositives); //Recall fro class 2 } } return(average.Apply(x => x / 5)); }