Package weka.classifiers.bayes.net.search

# Class SearchAlgorithm

java.lang.Object
weka.classifiers.bayes.net.search.SearchAlgorithm

All Implemented Interfaces:
  `Serializable`, `OptionHandler`, `RevisionHandler`

Direct Known Subclasses:
  `FromFile`, `GlobalScoreSearchAlgorithm`, `LocalScoreSearchAlgorithm`, `NaiveBayes`

public class SearchAlgorithm extends Object implements OptionHandler, Serializable, RevisionHandler
This is the base class for all search algorithms for learning Bayes networks. It contains some common code, used by other network structure search algorithms, and should not be used by itself.

Version:
  $Revision: 10153 $
Author:
  Remco Bouckaert
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SearchAlgorithm()`
  c'tor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `buildStructure(BayesNet bayesNet, Instances instances)`
  buildStructure determines the network structure/graph of the network.
  `String[]`
  `getOptions()`
  Gets the current settings of the Classifier.
  `String`
  `getRevision()`
  Returns the revision string.
  `String`
  `initAsNaiveBayesTipText()`
  `Enumeration<Option>`
  `listOptions()`
  Returns an enumeration describing the available options.
  `String`
  `maxNrOfParentsTipText()`
  `void`
  `setOptions(String[] options)`
  Parses a given list of options.
  `String`
  `toString()`
  a string representation of the algorithm

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SearchAlgorithm

    public SearchAlgorithm()
    c'tor

- ## Method Details

  - ### listOptions

    public Enumeration<Option> listOptions()
    Returns an enumeration describing the available options.
    Specified by:
      `listOptions` in interface `OptionHandler`
    Returns:
      an enumeration of all the available options.

  - ### setOptions

    public void setOptions(String[] options) throws Exception
    Parses a given list of options.

    Specified by:
      `setOptions` in interface `OptionHandler`
    Parameters:
      `options` - the list of options as an array of strings
    Throws:
      `Exception` - if an option is not supported

  - ### getOptions

    public String[] getOptions()
    Gets the current settings of the Classifier.
    Specified by:
      `getOptions` in interface `OptionHandler`
    Returns:
      an array of strings suitable for passing to setOptions

  - ### toString

    public String toString()
    a string representation of the algorithm
    Overrides:
      `toString` in class `Object`
    Returns:
      a string representation

  - ### buildStructure

    public void buildStructure(BayesNet bayesNet, Instances instances) throws Exception
    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.
    Parameters:
      `bayesNet` - the network
      `instances` - the data to use
    Throws:
      `Exception` - if something goes wrong

  - ### maxNrOfParentsTipText

    public String maxNrOfParentsTipText()
    Returns:
      a string to describe the MaxNrOfParentsoption.

  - ### initAsNaiveBayesTipText

    public String initAsNaiveBayesTipText()
    Returns:
      a string to describe the InitAsNaiveBayes option.

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Returns:
      the revision