confmat.cpp
来自「One kind of decision-making tree algorit」· C++ 代码 · 共 63 行
CPP
63 行
/*************************************************************************/
/* */
/* Routine for printing confusion matrices */
/* --------------------------------------- */
/* */
/*************************************************************************/
#include "defns.h"
#include "c45types.h"
#include "extern.h"
extern FILE *fpScreen;
void PrintConfusionMatrix(ItemNo * ConfusionMat)
/* -------------------- */
{
int Row, Col;
/* Print the heading, then each row */
fprintf(fpScreen,"\n\n\t");
printf("\n\n\t");
ForEach(Col, 0, MaxClass)
{
fprintf(fpScreen," (%c)", 'a' + Col);
printf(" (%c)", 'a' + Col);
}
fprintf(fpScreen,"\t<-classified as\n\t");
printf("\t<-classified as\n\t");
ForEach(Col, 0, MaxClass)
{
fprintf(fpScreen," ----");
printf(" ----");
}
fprintf(fpScreen,"\n");
printf("\n");
ForEach(Row, 0, MaxClass)
{
fprintf(fpScreen,"\t");
printf("\t");
ForEach(Col, 0, MaxClass)
{
if ( ConfusionMat[Row*(MaxClass+1) + Col] )
{
fprintf(fpScreen,"%5d", ConfusionMat[Row*(MaxClass+1) + Col]);
printf("%5d", ConfusionMat[Row*(MaxClass+1) + Col]);
}
else
{
fprintf(fpScreen," ");
printf(" ");
}
}
fprintf(fpScreen,"\t(%c): class %s\n", 'a' + Row, ClassName[Row]);
printf("\t(%c): class %s\n", 'a' + Row, ClassName[Row]);
}
fprintf(fpScreen,"\n");
printf("\n");
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?