Class BayesNetEstimator
java.lang.Object
weka.classifiers.bayes.net.estimate.BayesNetEstimator
- All Implemented Interfaces:
Serializable
,OptionHandler
,RevisionHandler
- Direct Known Subclasses:
MultiNomialBMAEstimator
,SimpleEstimator
public class BayesNetEstimator
extends Object
implements OptionHandler, Serializable, RevisionHandler
BayesNetEstimator is the base class for estimating
the conditional probability tables of a Bayes network once the structure has
been learned.
Valid options are:
-A <alpha> Initial count (alpha)
- Version:
- $Revision: 10153 $
- Author:
- Remco Bouckaert (rrb@xm.co.nz)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble[]
distributionForInstance
(BayesNet bayesNet, Instance instance) Calculates the class membership probabilities for the given test instance.void
estimateCPTs
(BayesNet bayesNet) estimateCPTs estimates the conditional probability tables for the Bayes Net using the network structure.double
getAlpha()
Get prior used in probability table estimationString[]
Gets the current settings of the classifier.Returns the revision string.This will return a string describing the class.void
initCPTs reserves space for CPTs and set all counts to zeroReturns an enumeration describing the available optionsvoid
setAlpha
(double fAlpha) Set prior used in probability table estimationvoid
setOptions
(String[] options) Parses a given list of options.void
updateClassifier
(BayesNet bayesNet, Instance instance) Updates the classifier with the given instance.
-
Constructor Details
-
BayesNetEstimator
public BayesNetEstimator()
-
-
Method Details
-
estimateCPTs
estimateCPTs estimates the conditional probability tables for the Bayes Net using the network structure.- Parameters:
bayesNet
- the bayes net to use- Throws:
Exception
- always throws an exception, since subclass needs to be used
-
updateClassifier
Updates the classifier with the given instance.- Parameters:
bayesNet
- the bayes net to useinstance
- the new training instance to include in the model- Throws:
Exception
- always throws an exception, since subclass needs to be used
-
distributionForInstance
Calculates the class membership probabilities for the given test instance.- Parameters:
bayesNet
- the bayes net to useinstance
- the instance to be classified- Returns:
- predicted class probability distribution
- Throws:
Exception
- always throws an exception, since subclass needs to be used
-
initCPTs
initCPTs reserves space for CPTs and set all counts to zero- Parameters:
bayesNet
- the bayes net to use- Throws:
Exception
- always throws an exception, since subclass needs to be used
-
listOptions
Returns an enumeration describing the available options- Specified by:
listOptions
in interfaceOptionHandler
- Returns:
- an enumeration of all the available options
-
setOptions
Parses a given list of options. Valid options are:-A <alpha> Initial count (alpha)
- Specified by:
setOptions
in interfaceOptionHandler
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the classifier.- Specified by:
getOptions
in interfaceOptionHandler
- Returns:
- an array of strings suitable for passing to setOptions
-
setAlpha
public void setAlpha(double fAlpha) Set prior used in probability table estimation- Parameters:
fAlpha
- representing prior
-
getAlpha
public double getAlpha()Get prior used in probability table estimation- Returns:
- prior
-
alphaTipText
- Returns:
- a string to describe the Alpha option.
-
globalInfo
This will return a string describing the class.- Returns:
- The string.
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-