Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.ru/~svit/term4/programm.txt
Дата изменения: Sat Apr 7 21:11:29 2007
Дата индексирования: Tue Oct 2 07:30:18 2012
Кодировка: Windows-1251
package quality;

/**
*

Title:


*

Description:


*

Copyright: Copyright (c) 2007


*

Company:


* @author not attributable
* @version 1.0
*/

public class Untitled1 {
public Untitled1() {
}

public static void main(String[] args) {
String OPM = "++++++++++++++++++++++++++++++++++++HHHHHHHHHHHHHHHHHHHHHH--" +
"--------------HHHHHHHHHHHHHHHHHHH++++++++HHHHHHHHHH----HHHHH" +
"HHHHHHHHHHHHHHHHH++++++++++++++++++++++++++HHHHHHHHHHHHHHHHH" +
"HH----------------HHHHHHHHHHHHHHHH++++++++HHHHHHHHHH--------" +
"-HHHHHHHHHHHHHHHHHHHH++++++++++++++++++++";
String Pred =
"+++++++++++++++++++++++++++++++++++++++HHHHHHHHHHHHHHHHHHHHH" +
"HH--------------HHHHHHHHHHHHHHHHHHHHHHH++++++++++++++++++++H" +
"HHHHHHHHHHHHHHHHHHHHHH-------------------HHHHHHHHHHHHHHHHHHH" +
"H++++++++++++HHHHHHHHHHHHHHHHHHHHHHH------------------------" +
"-HHHHHHHHHHHHHHHHHHHHHHH+++++++++++++++++";
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 = Pred.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 Sensivity = (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("Sensivity = " + " " + Sensivity);
System.out.println("Specificity = " + " " + Specificity);
System.out.println("Precision = " + " " + Precision);
System.out.println("Overprediction = " + " " + Overprediction);
System.out.println("Underprediction = " + " " + Underprediction);
}
}