org.encog.ml.bayesian.training.search.k2
Class SearchK2
- java.lang.Object
-
- org.encog.ml.bayesian.training.search.k2.SearchK2
-
- All Implemented Interfaces:
- BayesSearch
public class SearchK2 extends java.lang.Object implements BayesSearch
Search for optimal Bayes structure with K2.
-
-
Constructor Summary
Constructors Constructor and Description SearchK2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecalculateG(BayesianNetwork network, BayesianEvent event, java.util.List<BayesianEvent> parents)Calculate G.intcalculateN(BayesianNetwork network, BayesianEvent event, java.util.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.intcalculateN(BayesianNetwork network, BayesianEvent event, java.util.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.voidinit(TrainBayesian theTrainer, BayesianNetwork theNetwork, MLDataSet theData)Init the search object.booleaniteration()Perform an iteration.
-
-
-
Method Detail
-
init
public void init(TrainBayesian theTrainer, BayesianNetwork theNetwork, MLDataSet theData)
Init the search object.- Specified by:
initin interfaceBayesSearch- Parameters:
theTrainer- The trainer to use.theNetwork- The network to usetheData- The data to use.
-
calculateN
public int calculateN(BayesianNetwork network, BayesianEvent event, java.util.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, java.util.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, java.util.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:
iterationin interfaceBayesSearch- Returns:
- True to continue.
-
-
DMelt 3.0 © DataMelt by jWork.ORG