Package edu.cmu.tetrad.bayes
Class JunctionTreeUpdater
java.lang.Object
edu.cmu.tetrad.bayes.JunctionTreeUpdater
- All Implemented Interfaces:
BayesUpdater,ManipulatingBayesUpdater,TetradSerializable,Serializable
Jan 21, 2020 11:03:09 AM
- Author:
- Kevin V. Bui (kvb2@pitt.edu)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJunctionTreeUpdater(BayesIm bayesIm) JunctionTreeUpdater(BayesIm bayesIm, Evidence evidence) -
Method Summary
Modifier and TypeMethodDescriptiondouble[]calculatePriorMarginals(int nodeIndex) Calculates the prior marginal probabilities of the given node.double[]calculateUpdatedMarginals(int nodeIndex) Calculates the updated marginal probabilities of the given node, given the evidence.Returns the evidence for the updater.Returns the manipulation that was used to manipulate the Bayes IM.doublegetJointMarginal(int[] variables, int[] values) Returns the joint marginal probability of the given variables taking the given values, given the evidence.Returns the manipulated Bayes IM.Returns the manipulated graph.doublegetMarginal(int variable, int category) Returns the updated graph.Returns the updated Bayes IM.booleanReturns the joint marginal probability of the given variables taking the given values, given the evidence.voidsetEvidence(Evidence evidence) Sets new evidence for the updater.toString()
-
Constructor Details
-
JunctionTreeUpdater
-
JunctionTreeUpdater
-
-
Method Details
-
getManipulatedBayesIm
Description copied from interface:ManipulatingBayesUpdaterReturns the manipulated Bayes IM. This is the Bayes IM in which the variables in the manipulation have been removed from the graph.- Specified by:
getManipulatedBayesImin interfaceManipulatingBayesUpdater- Returns:
- the Bayes instantiated model after manipulations have been applied.
-
getManipulatedGraph
Description copied from interface:ManipulatingBayesUpdaterReturns the manipulated graph. This is the graph in which the variables in the manipulation have been removed from the graph.- Specified by:
getManipulatedGraphin interfaceManipulatingBayesUpdater- Returns:
- the graph for the manipulated BayesIm.
-
getEvidence
Description copied from interface:ManipulatingBayesUpdaterReturns the manipulation that was used to manipulate the Bayes IM.- Specified by:
getEvidencein interfaceManipulatingBayesUpdater- Returns:
- a defensive copy of the evidence.
-
setEvidence
Description copied from interface:ManipulatingBayesUpdaterSets new evidence for the updater. Once this is called, old updating results should not longer be available.- Specified by:
setEvidencein interfaceBayesUpdater- Specified by:
setEvidencein interfaceManipulatingBayesUpdater- Parameters:
evidence- the new evidence.
-
getUpdatedBayesIm
Description copied from interface:ManipulatingBayesUpdaterReturns the updated Bayes IM. This is the Bayes IM in which all probabilities of variables conditional on their parents have been updated.- Specified by:
getUpdatedBayesImin interfaceManipulatingBayesUpdater- Returns:
- the updated Bayes IM--that is, the Bayes IM in which all probabilities of variables conditional on their parents have been updated.
-
getMarginal
public double getMarginal(int variable, int category) Description copied from interface:ManipulatingBayesUpdaterReturns the updated graph. This is the graph in which all probabilities of variables conditional on their parents have been updated.- Specified by:
getMarginalin interfaceBayesUpdater- Specified by:
getMarginalin interfaceManipulatingBayesUpdater- Parameters:
variable- variable indexcategory- category index- Returns:
- P(variable = category | evidence) where evidence is getEvidence().
-
isJointMarginalSupported
public boolean isJointMarginalSupported()Description copied from interface:BayesUpdaterReturns the joint marginal probability of the given variables taking the given values, given the evidence.- Specified by:
isJointMarginalSupportedin interfaceBayesUpdater- Returns:
- true if the getJointMarginal() method is supported.
-
getJointMarginal
public double getJointMarginal(int[] variables, int[] values) Description copied from interface:BayesUpdaterReturns the joint marginal probability of the given variables taking the given values, given the evidence.- Specified by:
getJointMarginalin interfaceBayesUpdater- Parameters:
variables- variable indicesvalues- category indices- Returns:
- P(variables[i] = values[i] | evidence), where evidence is getEvidence().
-
getBayesIm
Description copied from interface:BayesUpdaterReturns the evidence for the updater.- Specified by:
getBayesImin interfaceBayesUpdater- Returns:
- the Bayes instantiated model that is being updated.
-
calculatePriorMarginals
public double[] calculatePriorMarginals(int nodeIndex) Description copied from interface:BayesUpdaterCalculates the prior marginal probabilities of the given node.- Specified by:
calculatePriorMarginalsin interfaceBayesUpdater- Parameters:
nodeIndex- node index- Returns:
- P(node = value), where value is the value of the node in the Bayes net.
-
calculateUpdatedMarginals
public double[] calculateUpdatedMarginals(int nodeIndex) Description copied from interface:BayesUpdaterCalculates the updated marginal probabilities of the given node, given the evidence.- Specified by:
calculateUpdatedMarginalsin interfaceBayesUpdater- Parameters:
nodeIndex- node index- Returns:
- P(node = value | evidence), where value is the value of the node in the Bayes net.
-
toString
-