package count; /** *
Title:
*Description:
*Copyright: Copyright (c) 2007
*Company:
* @author not attributable * @version 1.0 */ public class Count { public Count() { } public static void main(String[] args) { String OPM = ""; String Profil = ""; //*Соответствующие строки указываются вручную/копируются. ВАЖНО!: отсутствие пробелов в тексте строк. int len = OPM.length(); //*Считаем длину строки ОРМ int TP = 0, FP = 0, TN = 0, FN = 0, HCount = 0; for (int i = 0; i < len; i++) { char ch1 = OPM.charAt(i); char ch2 = Profil.charAt(i); if (ch2 == 'H') { HCount++; } if (ch1 == 'H' && ch2 == 'H') { TP++; } if (ch1 != 'H' && ch2 == 'H') { FP++; } if (ch1 == 'H' && ch2 != 'H') { FN++; } if (ch1 != 'H' && ch2 != 'H') { TN++; } } double Sensitivity = (double)TP / ((double)TP + (double)FN); double Specificity = (double)TN / ((double)TN + (double)FP); double Precision = (double)TP / ((double)TP + (double)FP); double Overprediction = (double)FP / ((double)FP + (double)TP); double Underprediction = (double)FN / ((double)TN + (double)FN); System.out.println("Остатки, предсказанные как локализованные в мембране = " + HCount); System.out.println("TP = " + TP); System.out.println("FP = " + FP); System.out.println("FN = " + FN); System.out.println("TN = " + TN); System.out.println("Sensitivity = " + Sensitivity); System.out.println("Specificity = " + Specificity); System.out.println("Precision = " + Precision); System.out.println("Overprediction = " + Overprediction); System.out.println("Underprediction = " + Underprediction); } }