Package weka.classifiers.bayes.net
Class BIFReader
java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.bayes.BayesNet
weka.classifiers.bayes.net.BIFReader
- All Implemented Interfaces:
Serializable
,Cloneable
,Classifier
,AdditionalMeasureProducer
,BatchPredictor
,CapabilitiesHandler
,CapabilitiesIgnorer
,CommandlineRunnable
,Drawable
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
,WeightedInstancesHandler
Builds a description of a Bayes Net classifier
stored in XML BIF 0.3 format.
For more details on XML BIF see:
Fabio Cozman, Marek Druzdzel, Daniel Garcia (1998). XML BIF version 0.3. URL http://www-2.cs.cmu.edu/~fgcozman/Research/InterchangeFormat/. BibTeX:
For more details on XML BIF see:
Fabio Cozman, Marek Druzdzel, Daniel Garcia (1998). XML BIF version 0.3. URL http://www-2.cs.cmu.edu/~fgcozman/Research/InterchangeFormat/. BibTeX:
@misc{Cozman1998, author = {Fabio Cozman and Marek Druzdzel and Daniel Garcia}, title = {XML BIF version 0.3}, year = {1998}, URL = {http://www-2.cs.cmu.edu/\~fgcozman/Research/InterchangeFormat/} }Valid options are:
-D Do not use ADTree data structure
-B <BIF file> BIF file to compare with
-Q weka.classifiers.bayes.net.search.SearchAlgorithm Search algorithm
-E weka.classifiers.bayes.net.estimate.SimpleEstimator Estimator algorithm
- Version:
- $Revision: 10153 $
- Author:
- Remco Bouckaert (rrb@xm.co.nz)
- See Also:
-
Field Summary
Fields inherited from class weka.classifiers.bayes.BayesNet
m_Distributions, m_Instances
Fields inherited from class weka.classifiers.AbstractClassifier
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
Fields inherited from interface weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
divergence
(BayesNet other) calculates the divergence between the probability distribution represented by this network and that of another, that is, \sum_{x\in X} P(x)log P(x)/Q(x) where X is the set of values the nodes in the network can take, P(x) the probability of this network for configuration x Q(x) the probability of the other network for configuration xint
Count nr of exta arcs from other network compared to current network Note that an arc is not 'extra' if it is reversed.getContent
(Element node) Returns all TEXT children of the given node in one string.returns the current filenameint
getNode finds the index of the node with name sNodeName and throws an exception if no such node can be found.Returns the revision string.Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.This will return a string describing the classifier.static void
Loads the file specified as first parameter and prints it to stdout.int
missingArcs
(BayesNet other) Count nr of arcs missing from other network compared to current network Note that an arc is not 'missing' if it is reversed.processFile
(String sFile) processFile reads a BIFXML file and initializes a Bayes NetprocessString
(String sStr) int
reversedArcs
(BayesNet other) Count nr of reversed arcs from other network compared to current networkvoid
synchronizes the node ordering of this Bayes network with those in the other network (if possible).Methods inherited from class weka.classifiers.bayes.BayesNet
BIFFileTipText, buildClassifier, buildStructure, countsForInstance, distributionForInstance, enumerateMeasures, estimateCPTs, estimatorTipText, getADTree, getBIFFile, getBIFHeader, getCapabilities, getCardinality, getDistributions, getEstimator, getMeasure, getName, getNodeName, getNodeValue, getNrOfNodes, getNrOfParents, getNumInstances, getOptions, getParent, getParentCardinality, getParentSet, getParentSets, getProbability, getSearchAlgorithm, getUseADTree, graph, graphType, initCPTs, initStructure, listOptions, measureAICScore, measureBayesScore, measureBDeuScore, measureDivergence, measureEntropyScore, measureExtraArcs, measureMDLScore, measureMissingArcs, measureReversedArcs, partitionOptions, searchAlgorithmTipText, setBIFFile, setEstimator, setOptions, setSearchAlgorithm, setUseADTree, toString, toXMLBIF03, updateClassifier, useADTreeTipText
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
Constructor Details
-
BIFReader
public BIFReader()the default constructor
-
-
Method Details
-
globalInfo
This will return a string describing the classifier.- Overrides:
globalInfo
in classBayesNet
- Returns:
- The string.
-
processFile
processFile reads a BIFXML file and initializes a Bayes Net- Parameters:
sFile
- name of the file to parse- Returns:
- the BIFReader
- Throws:
Exception
- if processing fails
-
processString
- Throws:
Exception
-
getFileName
returns the current filename- Returns:
- the current filename
-
getTechnicalInformation
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- Specified by:
getTechnicalInformation
in interfaceTechnicalInformationHandler
- Returns:
- the technical information about this class
-
Sync
synchronizes the node ordering of this Bayes network with those in the other network (if possible).- Parameters:
other
- Bayes network to synchronize with- Throws:
Exception
- if nr of attributes differs or not all of the variables have the same name.
-
getContent
Returns all TEXT children of the given node in one string. Between the node values new lines are inserted.- Parameters:
node
- the node to return the content for- Returns:
- the content of the node
-
missingArcs
Count nr of arcs missing from other network compared to current network Note that an arc is not 'missing' if it is reversed.- Parameters:
other
- network to compare with- Returns:
- nr of missing arcs
-
extraArcs
Count nr of exta arcs from other network compared to current network Note that an arc is not 'extra' if it is reversed.- Parameters:
other
- network to compare with- Returns:
- nr of missing arcs
-
divergence
calculates the divergence between the probability distribution represented by this network and that of another, that is, \sum_{x\in X} P(x)log P(x)/Q(x) where X is the set of values the nodes in the network can take, P(x) the probability of this network for configuration x Q(x) the probability of the other network for configuration x- Parameters:
other
- network to compare with- Returns:
- divergence between this and other Bayes Network
-
reversedArcs
Count nr of reversed arcs from other network compared to current network- Parameters:
other
- network to compare with- Returns:
- nr of missing arcs
-
getNode
getNode finds the index of the node with name sNodeName and throws an exception if no such node can be found.- Parameters:
sNodeName
- name of the node to get the index from- Returns:
- index of the node with name sNodeName
- Throws:
Exception
- if node cannot be found
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classBayesNet
- Returns:
- the revision
-
main
Loads the file specified as first parameter and prints it to stdout.- Parameters:
args
- the command line parameters
-