next up previous contents
Next: FAQ Up: Adding your own Bayesian Previous: Adding a new structure   Contents

Adding a new estimator

This is the quick guide for adding a new estimator:

  1. Create a class that derives from
    weka.classifiers.bayes.net.estimate.BayesNetEstimator. Let's say it is called
    weka.classifiers.bayes.net.estimate.MyEstimator.

  2. Implement the methods
    public void initCPTs(BayesNet bayesNet)
    public void estimateCPTs(BayesNet bayesNet)
    public void updateClassifier(BayesNet bayesNet, Instance instance), and
    public double[] distributionForInstance(BayesNet bayesNet, Instance instance).

  3. If the structure learner has options that are not default options, you want to implement public Enumeration listOptions(), public void setOptions(String[] options), public String[] getOptions() and the get and set methods for the properties you want to be able to set.

    NB do not use the -E option since that is reserved for the BayesNet class to distinguish the extra options for the SearchAlgorithm class and the Estimator class. If the -E option is used and no extra arguments are passed to the SearchAlgorithm, the extra options to your Estimator will be passed to the SearchAlgorithm instead. In short, do not use the -E option.



Remco Bouckaert 2008-05-12