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).
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCopy 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 betweenlowerBound
andupperBound
.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 Summary
Modifier and TypeMethodDescriptionboolean
Will return true if the argument is a BayesPm with the same graph and variables.getCategory
(Node node, int index) int
getCategoryIndex
(Node node, String category) getDag()
getNode
(int index) int
int
getNumCategories
(Node node) int
getVariable
(Node node) static BayesPm
Generates a simple exemplar of this class to test serialization.void
setCategories
(Node node, List<String> categories) void
setNumCategories
(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
-
BayesPm
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. -
BayesPm
Constructs a new BayesPm using a given DAG, using as much information from the old BayesPm as possible. -
BayesPm
Constructs a new BayesPm from the given DAG, assigning each variable a random number of values betweenlowerBound
andupperBound
. Uses a fixed number of values if lowerBound == upperBound. The values are named "value1" ... "valuen". -
BayesPm
Constructs 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 betweenlowerBound
andupperBound
. Uses a fixed number of values if lowerBound == upperBound. The values are named "value1" ... "valuen". -
BayesPm
Copy constructor.
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization. -
getParameterNames
-
getDag
- Returns:
- the DAG as a Graph.
-
getNumCategories
- Returns:
- the number of values for the given node.
-
getCategory
- Returns:
- the index'th value for the given node.
-
getCategoryIndex
- Returns:
- the index of the given category for the given node.
-
setNumCategories
Sets the number of values for the given node to the given number. -
equals
Will return true if the argument is a BayesPm with the same graph and variables. -
setCategories
-
getVariables
- Specified by:
getVariables
in interfaceVariableSource
- Returns:
- the list of variables associated with this object.
-
getVariableNames
- Specified by:
getVariableNames
in interfaceVariableSource
- Returns:
- the variable names associated with this getVariableNames.
-
getVariable
-
getMeasuredNodes
- Returns:
- the list of measured variableNodes.
-
toString
Prints out the list of values for each node. -
getNode
-
getNode
-
getNodeIndex
public int getNodeIndex() -
getNumNodes
public int getNumNodes()
-