Class GraphoidAxioms
java.lang.Object
edu.cmu.tetrad.search.utils.GraphoidAxioms
Checks the graphoid axioms for a set of Independence Model statements.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a graphoid independence fact--i.e., a fact in a general independence model (IM) X _||_Y | Z. -
Constructor Summary
ConstructorsConstructorDescriptionGraphoidAxioms(Set<GraphoidAxioms.GraphoidIndFact> facts, List<Node> nodes) Constructor.GraphoidAxioms(Set<GraphoidAxioms.GraphoidIndFact> facts, List<Node> nodes, Map<GraphoidAxioms.GraphoidIndFact, String> textSpecs) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the closure of the current fact set under the semigraphoid axioms (symmetry, decomposition, weak union, contraction), the graphoid axioms (semigraphoid + intersection), or the compositional graphoid axioms (graphoid + composition).booleanChecks if composition holds--e.g., (X _||_ Y | Z) ∧ (X _||_ W | Z) ==> X _||_ (Y ∪ W) | ZbooleanChecks whether the IM is a compositional graphoid.booleanChecks if contraction holds--e.g., (X _||_ Y | Z) ∧ (X _||_ W | Z ∪ Y) ==> X _||_ (Y ∪ W) | ZbooleanChecks if decomposition holds, e.g., X _||_ (Y ∪ W) | Z ==> (X _||_ Y | Z) ∧ (X _||_ W | Z)voidChecks if symmetry holds--i.e., X _||_ Y | Z ==> Y _||_ X | ZvoidSets whether triviality as assumed.Returns the independence facts in the form 1:2|3 for use in various Tetrad algorithms.booleangraphoid()Checks whether teh IM is a semigraphoid.booleanChecks if intersection holds--e.g., (X _||_ Y | (Z ∪ W)) ∧ (X _||_ W | (Z ∪ Y)) ==> X _||_ (Y ∪ W) | Zstatic voidThe main methods.booleanChecked whether the IM is a semigraphoid.singletonClosureWithComposition(Set<GraphoidAxioms.GraphoidIndFact> phase1Closure) Computes the singleton closure of independence facts using the composition rule, starting from an initial set of singleton independence facts.static Set<GraphoidAxioms.GraphoidIndFact> Returns the subset of a given set of GraphoidIndFacts where both X and Y are singleton sets--i.e., facts of the form {x} ⊥⊥ {y} | Z.booleansymmetry()Checks if symmetry holds--i.e., X ⊥⊥ Y | Z ==> Y ⊥⊥ X | ZbooleanChecks if weak union holds, e.g., X _||_ Y ∪ W | Z ==> X _||_ Y | Z ∪ W
-
Constructor Details
-
GraphoidAxioms
Constructor.- Parameters:
facts- A set of GraphoidIndFacts.nodes- The list of nodes.- See Also:
-
GraphoidAxioms
public GraphoidAxioms(Set<GraphoidAxioms.GraphoidIndFact> facts, List<Node> nodes, Map<GraphoidAxioms.GraphoidIndFact, String> textSpecs) Constructor.- Parameters:
facts- A list of GraphoidIndFacts.nodes- The list of nodes.textSpecs- A map from GraphoidIndFacts to String text specs. The text specs are used for printing information to the user about which facts are found or are missing.- See Also:
-
-
Method Details
-
main
The main methods.- Parameters:
args- E.g., "java -cp tetrad-gui-7.1.3-SNAPSHOT-launch.jar edu.cmu.tetrad.search.utils.GraphoidAxioms udags5.txt 5" Here, udgas5.txt is a file containing independence models, one per line, where each independence fast is specified by, e.g., "1:23|56", indicating that 1 is independence of 2 and 3 conditional on 5 and 6. No more than 9 variables can be handled this way. If you need more, let us know and we'll change the format.
-
semigraphoid
public boolean semigraphoid()Checked whether the IM is a semigraphoid.- Returns:
- True, if so.
-
graphoid
public boolean graphoid()Checks whether teh IM is a semigraphoid.- Returns:
- True, if so.
-
compositionalGraphoid
public boolean compositionalGraphoid()Checks whether the IM is a compositional graphoid.- Returns:
- True, if so.
-
getIndependenceFacts
Returns the independence facts in the form 1:2|3 for use in various Tetrad algorithms. Assumes decomposition and compositios, so that there are no complex independence facts.- Returns:
- a
IndependenceFactsobject
-
symmetry
public boolean symmetry()Checks if symmetry holds--i.e., X ⊥⊥ Y | Z ==> Y ⊥⊥ X | Z- Returns:
- a boolean
-
decomposition
public boolean decomposition()Checks if decomposition holds, e.g., X _||_ (Y ∪ W) | Z ==> (X _||_ Y | Z) ∧ (X _||_ W | Z)- Returns:
- a boolean
-
weakUnion
public boolean weakUnion()Checks if weak union holds, e.g., X _||_ Y ∪ W | Z ==> X _||_ Y | Z ∪ W- Returns:
- a boolean
-
contraction
public boolean contraction()Checks if contraction holds--e.g., (X _||_ Y | Z) ∧ (X _||_ W | Z ∪ Y) ==> X _||_ (Y ∪ W) | Z- Returns:
- a boolean
-
intersection
public boolean intersection()Checks if intersection holds--e.g., (X _||_ Y | (Z ∪ W)) ∧ (X _||_ W | (Z ∪ Y)) ==> X _||_ (Y ∪ W) | Z- Returns:
- a boolean
-
composition
public boolean composition()Checks if composition holds--e.g., (X _||_ Y | Z) ∧ (X _||_ W | Z) ==> X _||_ (Y ∪ W) | Z- Returns:
- a boolean
-
ensureTriviality
public void ensureTriviality()Sets whether triviality as assumed. -
ensureSymmetry
public void ensureSymmetry()Checks if symmetry holds--i.e., X _||_ Y | Z ==> Y _||_ X | Z -
closure
Returns the closure of the current fact set under the semigraphoid axioms (symmetry, decomposition, weak union, contraction), the graphoid axioms (semigraphoid + intersection), or the compositional graphoid axioms (graphoid + composition). Iterates to fixpoint.- Parameters:
type- One of "semigraphoid", "graphoid", or "compositional graphoid".- Returns:
- The closure set of GraphoidIndFacts.
-
singletonClosureWithComposition
public Set<GraphoidAxioms.GraphoidIndFact> singletonClosureWithComposition(Set<GraphoidAxioms.GraphoidIndFact> phase1Closure) Computes the singleton closure of independence facts using the composition rule, starting from an initial set of singleton independence facts. The composition rule allows the derivation of new independence facts from existing ones, specifically combining facts with the same X and Z sets but different Y sets.- Parameters:
phase1Closure- The initial set of singleton conditional independence facts of the form {x} ⊥⊥ {y} | Z.- Returns:
- A set of GraphoidIndFact objects representing the newly derived singleton independence facts obtained by applying the composition rule to the input set.
-
singletonFacts
public static Set<GraphoidAxioms.GraphoidIndFact> singletonFacts(Set<GraphoidAxioms.GraphoidIndFact> facts) Returns the subset of a given set of GraphoidIndFacts where both X and Y are singleton sets--i.e., facts of the form {x} ⊥⊥ {y} | Z.- Parameters:
facts- The set of facts to filter.- Returns:
- The filtered set containing only singleton CI facts.
-