NORSYS SOFTWARE © 2012 | NETICA API | C   VERSION   5.04  |
double GetTestConfusion_bn ( | tester_bn* test, node_bn* node, int predictedState, int actualState ) |
Returns the number of times the Net predicted predictedState for node, but the case file actually held actualState as the value of that node, during the performance test of a net. These are the entries of a table traditionally called the "confusion matrix".
For each case, the "prediction" is formed by reading the values of the "observed nodes" of that case in the file, using them to update beliefs in the net, and then picking the state of node which has the highest resultant belief (posterior probability) to be the prediction. The set of "observed nodes" is specified when creating the tester_bn.
node is required to have been in the test_nodes list originally passed to NewNetTester_bn.
Version:
See also:
GetTestErrorRate_bn | Get the fraction of test cases for which the prediction failed | |
GetTestLogLoss_bn | Get the "logarithmic loss" score of the test | |
GetTestQuadraticLoss_bn | Get the "quadratic loss" score of the test | |
NewNetTester_bn | Construct the tester_bn object |
Example:
See NewNetTester_bn for a program that creates a tester_bn, and uses the below function.The below function appears in NeticaEx.c:// Prints a confusion matrix table. Use after a tester_bn has run its tests. // This function can be found in examples\TestNet.c // that comes with this distribution. // void PrintConfusionMatrix (tester_bn* tester, node_bn* node){ int i,a,p; int numstates = GetNodeNumberStates_bn (node); printf ("\nConfusion matrix for %s:\n", GetNodeName_bn (node)); for (i=0; i < numstates; ++i) printf ("\t %s", GetNodeStateName_bn (node, i)); printf ("\t Actual\n"); for (a=0; a < numstates; ++a){ for (p=0; p < numstates; ++p) printf ("\t %d", (int) GetTestConfusion_bn (tester, node, p, a)); printf ("\t %s\n", GetNodeStateName_bn (node, a)); } printf ("\n"); } // Sample output: Confusion matrix for Cancer: Present Absent Actual 11 1 Present 4 184 Absent