org.encog.ml.bayesian.training.search.k2
Class SearchK2

java.lang.Object
  extended by org.encog.ml.bayesian.training.search.k2.SearchK2
All Implemented Interfaces:
BayesSearch

public class SearchK2
extends Object
implements BayesSearch

Search for optimal Bayes structure with K2.


Constructor Summary
SearchK2()
           
 
Method Summary
 double calculateG(BayesianNetwork network, BayesianEvent event, List<BayesianEvent> parents)
          Calculate G.
 int calculateN(BayesianNetwork network, BayesianEvent event, List<BayesianEvent> parents, int[] parentInstance)
          Calculate the value N, which is the number of cases, from the training data, where the desiredValue matches the training data.
 int calculateN(BayesianNetwork network, BayesianEvent event, List<BayesianEvent> parents, int[] parentInstance, int desiredValue)
          Calculate the value N, which is the number of cases, from the training data, where the desiredValue matches the training data.
 void init(TrainBayesian theTrainer, BayesianNetwork theNetwork, MLDataSet theData)
          Init the search object.
 boolean iteration()
          Perform an iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchK2

public SearchK2()
Method Detail

init

public void init(TrainBayesian theTrainer,
                 BayesianNetwork theNetwork,
                 MLDataSet theData)
Init the search object.

Specified by:
init in interface BayesSearch
Parameters:
theTrainer - The trainer to use.
theNetwork - The network to use
theData - The data to use.

calculateN

public int calculateN(BayesianNetwork network,
                      BayesianEvent event,
                      List<BayesianEvent> parents,
                      int[] parentInstance,
                      int desiredValue)
Calculate the value N, which is the number of cases, from the training data, where the desiredValue matches the training data. Only cases where the parents match the specifed parent instance are considered.

Parameters:
network - The network to calculate for.
event - The event we are calculating for. (variable i)
parents - The parents of the specified event we are considering.
parentInstance - The parent instance we are looking for.
desiredValue - The desired value.
Returns:
The value N.

calculateN

public int calculateN(BayesianNetwork network,
                      BayesianEvent event,
                      List<BayesianEvent> parents,
                      int[] parentInstance)
Calculate the value N, which is the number of cases, from the training data, where the desiredValue matches the training data. Only cases where the parents match the specifed parent instance are considered.

Parameters:
network - The network to calculate for.
event - The event we are calculating for. (variable i)
parents - The parents of the specified event we are considering.
parentInstance - The parent instance we are looking for.
Returns:
The value N.

calculateG

public double calculateG(BayesianNetwork network,
                         BayesianEvent event,
                         List<BayesianEvent> parents)
Calculate G.

Parameters:
network - The network to calculate for.
event - The event to calculate for.
parents - The parents.
Returns:
The value for G.

iteration

public boolean iteration()
Perform an iteration.

Specified by:
iteration in interface BayesSearch
Returns:
True to continue.


Copyright © 2014. All Rights Reserved.