Process Cases

Netica can process a file of cases.  For each case in the file, Netica reads the case and enters it as findings into a Bayes net.  Then Netica does belief updating to find probabilities for all the nodes that didn't have findings.  Finally Netica writes the results to an output file.

Note:  If the purpose is to grade the performance of the net, based on the cases, it is simpler to use Test With Cases.

Note:  If more control is needed, you may want to program Netica through its COM interface using Visual Basic, Java or C/C++.

How To:  First, open the Bayes net you wish to use.  Then choose Cases Process Cases from the menu.  The standard dialog box for opening a file will appear.  From it choose the control file (described below) that you wish to use.  When you click Okay, a new dialog box for opening case files will appear, from which you choose the case file to be processed.  After you click Okay, the dialog box for saving a file will appear, in which you enter the name of the file you want the results written to.

Netica will then proceed to process all the cases, printing the fraction completed in the Messages window (if that isn't obscured by the Bayes net window).  If you want to halt processing before it is completed, hold down the ctrl key and press the left mouse button.

If there are any findings entered into the network before processing starts, those findings will be used for all belief updating, even overriding findings found in the case file.  If an entered finding is going to override case file findings, you will be warned and asked if you want to retract all findings first.

Control File:  The control file is a text file which you can create by choosing File New Text Edit. You enter in this file what you wish to appear in each column of the output file (each row of the output file is for the results of one case).  The choices for columns are:

IDnum()

freq()

finding (<node>)

caseprob()

bel (<node>, <state>)

util (<node>, <state>)

belvec (<node>)

utilvec (<node>)

mostprob (<node>)

expval (<node>)

best(<node>)

stddev (<node>)

where <node> should be replaced with the name of a node (not its title), and <state> should be replaced with a state name for that node, or a # symbol followed by the state index (e.g., #0).

IDnum() and freq() transfer the IDnum and freq values from the case file to the output file.

finding (<node>) transfers the finding from the case file if there is one, otherwise it places the missing data symbol.

caseprob() displays the joint probability of all the findings of the case taken together (and including any findings entered directly in the net before processing was started).

bel (<node>, <state>) displays the belief that the value of <node> is <state>.  In other words, it puts P(<node> = <state> | findings), where findings are from the case, and those directly entered in the net before processing was started.

mostprob (<node>) provides the most probable state for <node>.

util (<node>, <state>) is for a decision node, and it displays the expected utility of making decision <state>.

best (<node>) provides the best decision for <node>, if that is available.

belvec (<node>) displays a list of numbers in parenthesis, each separated by a space, that are the beliefs for each of the states of <node>.

utilvec (<node>) is for a decision node, and it displays the expected utility of each decision of <node> in a parenthesized list.

expval (<node>) displays the expected value (i.e. mean value) of <node>, and stddev (<node>) puts the standard deviation of <node>.  These may only be used for continuous or numbered  variables.

Example:  Here is an example control file:

IDnum()

bel (Color, red)

bel (Color, blue)

bel (Color, green)

expval (Cost)

and here is the output file it created:

IDnum

P(Color=red)

P(Color=blue)

P(Color=green)

E[Cost]

1

0.000167195

0.0117262

0.988107

6.86929

2

0.422277

0.0130726

0.56465

3

3

0.610178

0.0203665

0.369455

3

4

0.324446

0.0163193

0.659235

5.94723

5

0.000381718

0.0893132

0.910305

3