Bayes Network learning using various search algorithms and quality measures.
Base class for a Bayes Network classifier. Provides datastructures (network structure, conditional probability distributions, etc.) and facilities common to Bayes Network learning algorithms like K2 and B.
buildStructure() buildStructure determines the network structure/graph of the network.
public double[]
countsForInstance(Instance instance) Calculates the counts for Dirichlet distribution for the
class membership probabilities for the given test instance.
getOptions() Gets the current settings of the classifier.
public int
getParent(int iNode, int iParent) get node index of a parent of a node in the network structure
Parameters: iNode - index of the node Parameters: iParent - index of the parents, e.g., 0 is the first parent, 1 the second parent, etc.
XMLNormalize converts the five standard XML entities in a string
g.e. the string V&D's is returned as V&D's
Parameters: sStr - string to normalize normalized string
Generates the classifier.
Parameters: instances - set of instances serving as training data throws: Exception - if the classifier has not been generatedsuccessfully
buildStructure determines the network structure/graph of the network.
The default behavior is creating a network where all nodes have the first
node as its parent (i.e., a BayesNet that behaves like a naive Bayes classifier).
This method can be overridden by derived classes to restrict the class
of network structures that are acceptable.
throws: Exception - in case of an error
Calculates the counts for Dirichlet distribution for the
class membership probabilities for the given test instance.
Parameters: instance - the instance to be classified counts for Dirichlet distribution for class probability throws: Exception - if there is a problem generating the prediction
Calculates the class membership probabilities for the given test
instance.
Parameters: instance - the instance to be classified predicted class probability distribution throws: Exception - if there is a problem generating the prediction
Returns an enumeration of the measure names. Additional measures
must follow the naming convention of starting with "measure", eg.
double measureBlah()
an enumeration of the measure names
Get the BayesNetEstimator used for calculating the CPTs
the BayesNetEstimator used.
getMeasure
public double getMeasure(String measureName)(Code)
Returns the value of the named measure
Parameters: measureName - the name of the measure to query for its value the value of the named measure throws: IllegalArgumentException - if the named measure is not supported
get name of a node in the Bayes network
Parameters: iNode - index of the node name of the specified node
getNodeValue
publicString getNodeValue(int iNode, int iValue)(Code)
get name of a particular value of a node
Parameters: iNode - index of the node Parameters: iValue - index of the value cardinality of the specified node
Gets the current settings of the classifier.
an array of strings suitable for passing to setOptions
getParent
public int getParent(int iNode, int iParent)(Code)
get node index of a parent of a node in the network structure
Parameters: iNode - index of the node Parameters: iParent - index of the parents, e.g., 0 is the first parent, 1 the second parent, etc. node index of the iParent's parent of the specified node
get number of values the collection of parents of a node can take
Parameters: iNode - index of the node cardinality of the parent set of the specified node
public double getProbability(int iNode, int iParent, int iValue)(Code)
get particular probability of the conditional probability distribtion
of a node given its parents.
Parameters: iNode - index of the node Parameters: iParent - index of the parent set, 0 <= iParent <= getParentCardinality(iNode) Parameters: iValue - index of the value, 0 <= iValue <= getCardinality(iNode) probability
Returns a BayesNet graph in XMLBIF ver 0.3 format.
String representing this BayesNet in XMLBIF ver 0.3 throws: Exception - in case BIF generation fails
ensure that all variables are nominal and that there are no missing values
Parameters: instances - data set to check and quantize and/or fill in missing values filtered instances throws: Exception - if a filter (Discretize, ReplaceMissingValues) fails
ensure that all variables are nominal and that there are no missing values
Parameters: instance - instance to check and quantize and/or fill in missing values filtered instance throws: Exception - if a filter (Discretize, ReplaceMissingValues) fails
Returns the secondary set of options (if any) contained in
the supplied options array. The secondary set is defined to
be any options after the first "--" but before the "-E". These
options are removed from the original options array.
Parameters: options - the input array of options the array of secondary options
Returns a description of the classifier in XML BIF 0.3 format.
See http://www-2.cs.cmu.edu/~fgcozman/Research/InterchangeFormat/
for details on XML BIF.
an XML BIF 0.3 description of the classifier as a string.
Updates the classifier with the given instance.
Parameters: instance - the new training instance to include in the model throws: Exception - if the instance could not be incorporated inthe model.