|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBN2Prism
public class BN2Prism
The main class of the translator. The name of the input network file should be "BASENAME.xml".
[Usage] java BN2Prism [-f FORMAT][-o][-t][-r][-e][-z][-n][-v][-h] BASENAME
Command line options:
-f FORMAT
: the input format is FORMAT (xmlbif or xbif; default: xmlbif). -o
: the translator reads an external file (named BASENAME.num) that specifies
the elimination order. -t
: the translator reads transposed CPTs.-r
: the translator assigns random probabilities to the parameters.-e
: the translator generates auxiliary files that specify the random
evidences.-z
: the translator makes zero-compression of CPTs.-n
: the translator normalizes the entries in CPTs.-v
: the translator outputs detailed messages as comments.-V
: the translator outputs the version.-h
: a brief help is displayed.
FORMAT is either xmlbif
(for XMLBIF) or xbif
(for XBIF).
The default is XMLBIF. XMLBIF used here is basically based on XMLBIF 0.3,
but the entries in each CPT have a different order from those in XMLBIF 0.3
(actually, the order is same as that of XMLBIF 0.5). We can switch the entry
order by the -t
option. XBIF, on the other hand, is the format
adopted in UAI-06 Evaluation Workshop. When XMLBIF is specified, a separate
evidence file (in so-called XMLBIF-EVIDENCE format) "BASENAME_evid.xml" is
required to take evidences into account.
After running the command, the network spacification is translated into a PRISM
file named "BASENAME.psm" The evidences (if given) are translated into a separate
file named "BASENAME_evid.psm". If the -e
option is specified, the
translator generates a couple of files each of which contains randomly generated
evidences.
For example, the ALARM network is specified in "alarm.xml" in the XMLBIF format, we can get the join-tree PRISM program for the ALARM network by running:
java BN2Prism -f xmlbif alarm(we can omit "-f xmlbif" since it is the default). Please note here that we need to prepare the evidence file named "alarm_evid.xml" unless we assign the random probabilities to CPTs (with the
-r
option) or have no evidences.
Even if alarm.xml have CPTs with the transposed form, we can force the translator
to accept such CPTs by specifying the -t
option:
java BN2Prism -f xmlbif -t alarmOn the other hand, when the network is provided in the XBIF format, the
-f
option is mandatory. In this case, the evidences are buried
in the network specification, so no separate evidence file is required.
java BN2Prism -f xbif alarm
Field Summary | |
---|---|
private BNSetting |
setting
Settings for the translator. |
static java.lang.String |
USAGE
Message on usage |
static java.lang.String |
VERSION
String representation of the version number |
Constructor Summary | |
---|---|
BN2Prism()
The default setting will be set. |
Method Summary | |
---|---|
BayesNet |
buildBN()
Parse the input XMLBIF file, and store the information to the intermediate data structure. |
java.lang.String |
getNodeString(org.w3c.dom.Node n)
Get the string which denotes the contents of a node. |
BNSetting |
getSetting()
Returns the current setting of the translator. |
static void |
main(java.lang.String[] args)
Main method. |
private void |
parseArgs(java.lang.String[] args)
|
private void |
printDocument(org.w3c.dom.Document document)
Display the contents in a DOM tree. |
private void |
traverse(org.w3c.dom.Node n,
int indent)
Display the contents of a DOM tree recursively. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String USAGE
public static final java.lang.String VERSION
private BNSetting setting
Constructor Detail |
---|
public BN2Prism()
Method Detail |
---|
public BNSetting getSetting()
public static void main(java.lang.String[] args)
args
- An array of strings which contains command arguments.
It is assumed that args[0]
is the
filename of the input file.private void parseArgs(java.lang.String[] args) throws B2PException
B2PException
public BayesNet buildBN()
private void printDocument(org.w3c.dom.Document document)
document
- DOM tree to be displayed.private void traverse(org.w3c.dom.Node n, int indent)
n
- the node we are visiting at.indent
- the width of indentation.public java.lang.String getNodeString(org.w3c.dom.Node n)
n
- a node in DOM.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |