Package edu.cmu.tetrad.bayes
Class ApproximateUpdater
java.lang.Object
edu.cmu.tetrad.bayes.ApproximateUpdater
- All Implemented Interfaces:
- BayesUpdater,- ManipulatingBayesUpdater,- TetradSerializable,- Serializable
Calculates updated marginals for a Bayes net by simulating data and
 calculating likelihood ratios. The method is as follows. For P(A | B), enough
 sample points are simulated from the underlying BayesIm so that 1000 satisfy
 the condition B. Then the maximum likelihood estimate of condition A is
 calculated.
- Author:
- Joseph Ramsey
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionApproximateUpdater(BayesIm bayesIm) ApproximateUpdater(BayesIm bayesIm, Evidence evidence) Constructs a new updater for the given Bayes net.
- 
Method SummaryModifier and TypeMethodDescriptiondouble[]calculatePriorMarginals(int nodeIndex) double[]calculateUpdatedMarginals(int nodeIndex) doublegetJointMarginal(int[] variables, int[] values) doublegetMarginal(int variable, int value) booleanstatic ApproximateUpdatervoidsetEvidence(Evidence evidence) Sets new evidence for the next update operation.toString()Prints out the most recent marginal.
- 
Constructor Details- 
ApproximateUpdater
- 
ApproximateUpdaterConstructs a new updater for the given Bayes net.
 
- 
- 
Method Details- 
serializableInstance- Returns:
- a simple exemplar of this class to test serialization.
 
- 
getBayesIm- Specified by:
- getBayesImin interface- BayesUpdater
- Returns:
- the Bayes instantiated model that is being updated.
 
- 
getManipulatedBayesIm- Specified by:
- getManipulatedBayesImin interface- ManipulatingBayesUpdater
- Returns:
- the Bayes instantiated model after manipulations have been applied.
 
- 
getManipulatedGraph- Specified by:
- getManipulatedGraphin interface- ManipulatingBayesUpdater
- Returns:
- the graph for getManipulatedBayesIm().
 
- 
getUpdatedBayesIm- Specified by:
- getUpdatedBayesImin interface- ManipulatingBayesUpdater
- Returns:
- the updated Bayes IM, or null if there is no updated Bayes IM.
 
- 
getEvidence- Specified by:
- getEvidencein interface- ManipulatingBayesUpdater
- Returns:
- a copy of the getModel evidence.
 
- 
setEvidenceSets new evidence for the next update operation.- Specified by:
- setEvidencein interface- BayesUpdater
- Specified by:
- setEvidencein interface- ManipulatingBayesUpdater
 
- 
getMarginalpublic double getMarginal(int variable, int value) - Specified by:
- getMarginalin interface- BayesUpdater
- Specified by:
- getMarginalin interface- ManipulatingBayesUpdater
- Returns:
- P(variable = category | evidence) where evidence is getEvidence().
 
- 
isJointMarginalSupportedpublic boolean isJointMarginalSupported()- Specified by:
- isJointMarginalSupportedin interface- BayesUpdater
- Returns:
- true if the getJointMarginal() method is supported.
 
- 
getJointMarginalpublic double getJointMarginal(int[] variables, int[] values) - Specified by:
- getJointMarginalin interface- BayesUpdater
- Returns:
- the joint marginal.
 
- 
calculatePriorMarginalspublic double[] calculatePriorMarginals(int nodeIndex) - Specified by:
- calculatePriorMarginalsin interface- BayesUpdater
 
- 
calculateUpdatedMarginalspublic double[] calculateUpdatedMarginals(int nodeIndex) - Specified by:
- calculateUpdatedMarginalsin interface- BayesUpdater
 
- 
toStringPrints out the most recent marginal.
 
-