Download Netica API C Version - Norsys Software Corp.
Transcript
C VERSION 4.18
NETICA API
175
If conditions 1 or 2 are violated, it will still be much faster than doing a new belief updating, but not as fast as if they
aren't violated. If the other conditions are violated, then it will take the same time as 1 or 2 belief updatings.
All of nodes must come from the same Bayes net.
None of nodes should have a likelihood finding (but they may have other types of findings, and other nodes in the
net may have likelihood findings).
You can be sure a set of nodes will be placed in the same clique if there is some "family" in the Bayes net which
contains all of them.
A family consists of a node and its parents. The function FormCliqueWith (in the example below and in
NeticaEx.c) can be used to ensure that all of nodes will be put in the same clique during the next compile.
Version:
Versions 1.18 and later have this function.
In versions previous to 2.10 this function was named GetJointProb_bn.
See also:
FindingsProbability_bn
GetNodeBeliefs_bn
GetNodeProbs_bn
Joint probability for current findings
Posterior probability for a single node
Gets CPT entries of a node
Example:
The following function is available in NeticaEx.c:
// Ensures that at the next compile all of nodes will be put in the same clique.
// It is useful for the JointProbability_bn function.
// It works by adding a dummy node with 1 state, and returning that node (or NULL if it
//
wasn't necessary to add one).
// Its effects can be completely undone by calling DeleteNode_bn on the node it returns.
//
node_bn* FormCliqueWith (const nodelist_bn* nodes){
net_bn* net;
node_bn* new_node;
int i, num_nodes = LengthNodeList_bn (nodes);
if (num_nodes <= 1) return NULL;
net = GetNodeNet_bn (NthNode_bn (nodes, 0));
new_node = NewNode_bn (NULL, 1, net);
for (i = 0; i < num_nodes; ++i)
AddLink_bn (NthNode_bn (nodes, i), new_node);
return new_node;
}
Learn CPTs_bn
void LearnCPTs_bn (learner_bn* learner, const nodelist_bn* nodes,
const caseset_cs* cases, double degree)
Performs learning of CPT tables from data. For EM or gradient descent algorithms this is done until a termination
condition is met.
learner is the learner object that performs the learning steps. Construct it with NewLearner_bn.
nodes is the list of nodes whose experience and conditional probability tables are to be updated by learning. They
must all be from the same net. Other nodes in that net will not be modified.
cases is the set of cases to be used for learning.
degree is the frequency factor to apply to each case in the case set. It must be greater than zero. It gets multiplied
by the "NumCases" (multiplicity number) which appears for each case in the file (if the number doesn't appear in the
file, it is taken as 1).
When you create the learner_bn (see NewLearner_bn), you choose the algorithm you wish, which may be one
of:
1. Counting Learning
This is traditional one-pass learning (see ReviseCPTsByFindings_bn) ... . It is the preferred learning method to use, if