Module es.upm.fi.cig.multictbnc
Class BNSufficientStatistics
java.lang.Object
es.upm.fi.cig.multictbnc.learning.parameters.bn.BNSufficientStatistics
- All Implemented Interfaces:
SufficientStatistics
Compute and store the sufficient statistics of a discrete BN node. The sufficient statistics are:
(1) Nx: number of times a variable takes a certain state.
-
Constructor Summary
ConstructorDescriptionBNSufficientStatistics
(double nHP) Constructs aBNSufficientStatistics
by receiving the hyperparameter of the Dirichlet prior distribution. -
Method Summary
Modifier and TypeMethodDescriptionvoid
computeSufficientStatistics
(DiscreteStateNode node, Dataset dataset) Computes the sufficient statistics of a node in a BN.double[][]
getNx()
Returns the sufficient statistics of the node.double
Returns the hyperparameter value of the Dirichlet prior distribution.
-
Constructor Details
-
BNSufficientStatistics
public BNSufficientStatistics(double nHP) Constructs aBNSufficientStatistics
by receiving the hyperparameter of the Dirichlet prior distribution.- Parameters:
nHP
- number of times the variables are in a certain state while its parents take a certain instantiation (hyperparameter)
-
-
Method Details
-
getNx
public double[][] getNx()Returns the sufficient statistics of the node. This is the number of times the variable is in a certain state while its parents take a certain instantiation.- Returns:
- array with the number of appearances of each state of the node given an instantiation of the parents
-
getNxHyperparameter
public double getNxHyperparameter()Returns the hyperparameter value of the Dirichlet prior distribution.- Returns:
- hyperparameter value
-
computeSufficientStatistics
Computes the sufficient statistics of a node in a BN. This is the number of times the variable is in a certain state while its parents take a certain instantiation.- Specified by:
computeSufficientStatistics
in interfaceSufficientStatistics
- Parameters:
dataset
- dataset from which the sufficient statistics are extractednode
- node whose sufficient statistics are computed
-