Constructor
BayesOWL Constructor contains two parts,
1. Using a BNConstructor
To use the Structure Constructor, you should first import class
To build a Bayesian Net, you should provide a list of node names (an array of String), node types (an array of TAG, defined in class
BNConstructor myBNConstructor = new BNConstructor ();
myBNConstructor.constructBN(nodeNames, tags, parentNodeNames);
Important: length of array nodeNames, tags and relationships should be the same. And each node name relates to a tag and an array of parent node names. For example, node
After the Bayesian Net is built, you can use it by calling the
// to get a built BN
Net net = myBNConstructor.getNet();
// to save a BN
myBNConstructor.saveBNNet(Ħ°D:\\somedirectory\\savedNet.dneĦħ);
*Note: BayesOWL Translator will automatically set a series of Conditional Probability Tables for the result BN's nodes. Such CPTs are initialized according to our translation rules. Details can be seen in related research papers.
2. Example
Again take the
Environ NeticaEnv = new Environ(NeticaLicense);
String[] nodeNames = myTParser.getNames();
ExNode.TAG[] tags = myTParser.getTags();
String[][] parentNodeNames = myTParser.getParents();
BNConstructor myBNConstructor = new BNConstructor();
myBNConstructor.constructBN(nodeNames, tags, parentNodeNames);
Net net = myBNConstructor.getNet();
//code for other use of the BN
myBNConstructor.saveBNNet(Ħ°D:\\somedirectory\\savedNet.dneĦħ);
NeticaEnv.finalize();
1. Introduction
BayesOWL CPTConstructor is designed for integrating uncertainty knowledge into Bayesian Nets. It uses our IPFP-based algorithms, e.g. DIPFP, to modify BN nodes' Conditional Probability Tables (CPTs). It iteratively changes CPTs to satisfy probabilities given in constraints and finally integrates uncertainty knowledge into target BN. Details can be seen in our research papers listed in references chapter.
2. Using a CPTConstructor
To use BayesOWL CPTConstructor, you should first import class
You should first provide a Bayesian Net and uncertainty knowledge (represented as probability). Probabilities can be given by parsing probability files, written in a specific format, by BayesOWL P-Parser, see details in Chapter 4, or by user definitions. If you are going to use self-defined probabilities, you should prefer to some pre-defined classes included in package
When you have things required in hand, then you can start your integration work with BayesOWL CPTConstructor.
CPTConstructor myCPTConstructor = new CPTConstructor(net, constraint);
myCPTConstructor.run(maxLoops, threshold);
If you have read our research papers carefully, you will find that parameters
Important: If constraint used here is
After integrating uncertainty knowledge, you can use result BN by calling the
// to get a built BN
Net net = myCPTConstructor.getNet();
// to save a BN
myCPTConstructor.saveBNNet(Ħ°D:\\somedirectory\\savedNet.dneĦħ)
Remember that you should need Netica to open the saved result net.
3. Example
Take our
Environ NeticaEnv = new Environ(NeticaLicense);
Constraint[] myConstraint = myPParser.getConstraint();
CPTConstructor myCPTConstructor = new CPTConstructor(myBNNet, myConstraint);
myCPTConstructor.run(maxLoops, threshold);
Net net = myCPTConstructor.getNet();
//code for other use of the BN
myCPTConstructor.saveBNNet(Ħ°D:\\somedirectory\\savedNet.dneĦħ);
NeticaEnv.finalize();
When you are going to use self-defined constraints, you can do it this way:
Environ NeticaEnv = new Environ(NeticaLicense);
Constraint[] myConstraint = new Constraint[constraintNumber];
//construct your constraints here
CPTConstructor myCPTConstructor = new CPTConstructor(myBNNet, myConstraint);
myCPTConstructor.run(maxLoops, threshold);
Net net = myCPTConstructor.getNet();
//code for other use of the BN
myCPTConstructor.saveBNNet(Ħ°D:\\somedirectory\\savedNet.dneĦħ);
NeticaEnv.finalize();