public class DiscreteBayesNetwork extends Object implements Classifier
depends(int, int)
method. The target class should be specified
as the parent of the variables which have a causal relationship to it. These children of the target class
should then have their own children specified. Once the structure has been specified, the network can be
trained and used for classification. NaiveBayes
implementation.Modifier and Type | Field and Description |
---|---|
protected Map<Integer,ConditionalProbabilityTable> |
cpts
The Conditional probability tables for each variable
|
protected DirectedGraph<Integer> |
dag
The directed Graph that represents this BN
|
static boolean |
DEFAULT_USE_PRIORS
Whether or not the classifier should take into account the prior probabilities.
|
protected CategoricalData |
predicting
The class we are predicting
|
protected double[] |
priors
The prior probabilities of each class value
|
Constructor and Description |
---|
DiscreteBayesNetwork() |
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
Classifier |
clone() |
void |
depends(int parent,
int child)
Adds a dependency relation ship between two variables that will be in the network.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
protected DirectedGraph<Integer> dag
protected Map<Integer,ConditionalProbabilityTable> cpts
protected CategoricalData predicting
protected double[] priors
public static final boolean DEFAULT_USE_PRIORS
public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic void depends(int parent, int child)
parent
- the parent variable, which will be explained in part by the childchild
- the child variable, which contributes to the conditional probability of the parent.public void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
public Classifier clone()
clone
in interface Classifier
clone
in class Object
Copyright © 2017. All rights reserved.