jsat.classifiers.bayesian.graphicalmodel
Class K2NetworkLearner
- java.lang.Object
-
- jsat.classifiers.bayesian.graphicalmodel.DiscreteBayesNetwork
-
- jsat.classifiers.bayesian.graphicalmodel.K2NetworkLearner
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier
public class K2NetworkLearner extends DiscreteBayesNetwork
An implementation of the K2 algorithm for learning the structure of a Bayesian Network. When trained, if no network has been specified, the K2 algorithm will attempt to learn a network structure. The network structure can also be learned by callinglearnNetwork(jsat.classifiers.ClassificationDataSet)directly.
Note, that the K2 algorithm attempts to learn a whole network structure, and may learn things that are relevant for the classification task. K2 often does not provide satisfactory results for classification.
See: A bayesian method for the induction of probabilistic networks from data. Gregory F. Cooper and Edward Herskovits.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class jsat.classifiers.bayesian.graphicalmodel.DiscreteBayesNetwork
DEFAULT_USE_PRIORS
-
-
Constructor Summary
Constructors Constructor and Description K2NetworkLearner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublef(int i, java.util.Set<java.lang.Integer> pi, ClassificationDataSet D)intgetMaxParents()Returns the maximum number of parents allowed when learning a network structure, or zero if any number of parents are valid.voidlearnNetwork(ClassificationDataSet D)Learns the network structure from the given data set.voidsetMaxParents(int maxParents)Sets the maximum number of parents to allow a node when learning the network structure.voidtrain(ClassificationDataSet dataSet)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class jsat.classifiers.bayesian.graphicalmodel.DiscreteBayesNetwork
classify, clone, depends, supportsWeightedData, train
-
-
-
-
Method Detail
-
setMaxParents
public void setMaxParents(int maxParents)
Sets the maximum number of parents to allow a node when learning the network structure. If a non zero value is supplied, nodes will be allowed any number of parents.- Parameters:
maxParents- sets the maximum number of parents a node may learn
-
getMaxParents
public int getMaxParents()
Returns the maximum number of parents allowed when learning a network structure, or zero if any number of parents are valid.- Returns:
- the maximum number of parents a node man learn
-
learnNetwork
public void learnNetwork(ClassificationDataSet D)
Learns the network structure from the given data set.- Parameters:
D- the data set to learn the network from
-
train
public void train(ClassificationDataSet dataSet)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set.- Specified by:
trainin interfaceClassifier- Overrides:
trainin classDiscreteBayesNetwork- Parameters:
dataSet- the data set to train on
-
f
public double f(int i, java.util.Set<java.lang.Integer> pi, ClassificationDataSet D)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG