Package edu.cmu.tetrad.bayes
Class BayesPm
java.lang.Object
edu.cmu.tetrad.bayes.BayesPm
- All Implemented Interfaces:
- VariableSource,- Pm,- TetradSerializable,- Serializable
Implements a discrete Bayes parametric model--that is, a DAG together with a map from the nodes in the graph to a set
 of discrete variables, specifying the number of categories for each variable and the name of each category for each
 variable. This is all the information one needs to know in order to determine the parametric form of a Bayes net up
 to actual values of parameters. Specific values for the Bayes net are stored in a BayesIM object (see).
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCopy constructor.Construct a new BayesPm using the given DAG, assigning each variable two values named "value1" and "value2" unless nodes are discrete variables with categories already defined.Constructs a new BayesPm from the given DAG, assigning each variable a random number of values betweenlowerBoundandupperBound.Constructs a new BayesPm using a given DAG, using as much information from the old BayesPm as possible.Constructs a new BayesPm from the given DAG, using as much information from the old BayesPm as possible.
- 
Method SummaryModifier and TypeMethodDescriptionbooleangetCategory(Node node, int index) Returns the index'th value for the given node.intgetCategoryIndex(Node node, String category) Returns the index of the given category for the given node.getDag()Returns the DAG.Returns the measured nodes.getNode(int index) Returns the node at the given index.Returns the node by the given name.intReturns the node index.intgetNumCategories(Node node) Returns the number of values for the given node.intReturns the number of nodes.Returns the parameter names.getVariable(Node node) Returns the variable for the given node.Returns the variable names.getVariables.static BayesPmGenerates a simple exemplar of this class to test serialization.voidsetCategories(Node node, List<String> categories) Sets the number of values for the given node to the given number.voidsetNumCategories(Node node, int numCategories) Sets the number of values for the given node to the given number.toString()Prints out the list of values for each node.
- 
Constructor Details- 
BayesPmConstruct a new BayesPm using the given DAG, assigning each variable two values named "value1" and "value2" unless nodes are discrete variables with categories already defined.- Parameters:
- graph- Ibid.
 
- 
BayesPmConstructs a new BayesPm using a given DAG, using as much information from the old BayesPm as possible.- Parameters:
- graph- Ibid.
- oldBayesPm- Ibid.
 
- 
BayesPmConstructs a new BayesPm from the given DAG, assigning each variable a random number of values betweenlowerBoundandupperBound. Uses a fixed number of values if lowerBound == upperBound. The values are named "value1" ... "valuen".- Parameters:
- graph- Ibid.
- lowerBound- Ibid.
- upperBound- Ibid.
 
- 
BayesPmConstructs a new BayesPm from the given DAG, using as much information from the old BayesPm as possible. For variables not in the old BayesPm, assigns each variable a random number of values betweenlowerBoundandupperBound. Uses a fixed number of values if lowerBound == upperBound. The values are named "value1" ... "valuen".- Parameters:
- graph- Ibid.
- oldBayesPm- Ibid.
- lowerBound- Ibid.
- upperBound- Ibid.
 
- 
BayesPmCopy constructor.- Parameters:
- bayesPm- Ibid.
 
 
- 
- 
Method Details- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.- Returns:
- Ibid.
 
- 
getParameterNamesReturns the parameter names.- Returns:
- Ibid.
 
- 
getDagReturns the DAG.- Returns:
- the DAG as a Graph.
 
- 
getNumCategoriesReturns the number of values for the given node.- Parameters:
- node- Ibid.
- Returns:
- the number of values for the given node.
 
- 
getCategoryReturns the index'th value for the given node.- Parameters:
- node- Ibid.
- index- Ibid.
- Returns:
- the index'th value for the given node.
 
- 
getCategoryIndexReturns the index of the given category for the given node.- Parameters:
- node- Ibid.
- category- Ibid.
- Returns:
- the index of the given category for the given node.
 
- 
setNumCategoriesSets the number of values for the given node to the given number.- Parameters:
- node- Ibid.
- numCategories- Ibid.
 
- 
equalsWill return true if the argument is a BayesPm with the same graph and variables. 
- 
setCategoriesSets the number of values for the given node to the given number.- Parameters:
- node- Ibid.
- categories- Ibid.
 
- 
getVariablesgetVariables. - Specified by:
- getVariablesin interface- VariableSource
- Returns:
- a Listobject
 
- 
getVariableNamesReturns the variable names.- Specified by:
- getVariableNamesin interface- VariableSource
- Returns:
- Ibid.
 
- 
getVariableReturns the variable for the given node.- Parameters:
- node- Ibid.
- Returns:
- Ibid.
 
- 
getMeasuredNodesReturns the measured nodes.- Returns:
- the list of measured variableNodes.
 
- 
toStringPrints out the list of values for each node.
- 
getNodeReturns the node by the given name.- Parameters:
- nodeName- Ibid.
- Returns:
- Ibid.
 
- 
getNodeReturns the node at the given index.- Parameters:
- index- Ibid.
- Returns:
- Ibid.
 
- 
getNodeIndexpublic int getNodeIndex()Returns the node index.- Returns:
- -1.
 
- 
getNumNodespublic int getNumNodes()Returns the number of nodes.- Returns:
- Ibid.
 
 
-