Class MarkovCheck
Checks whether a graph is locally Markov or locally Faithful given a data set. First a lists of m-separation predictions are made for each pair of variables in the graph given the parents of one of the variables, one list (for local Markov) where the m-separation holds and another list (for local Faithfulness) where the m-separation does not hold. Then the predictions are tested against the data set using the independence test. For the Markov test, since an independence test yielding p-values should be Uniform under the null hypothesis, these p-values are tested for Uniformity using the Kolmogorov-Smirnov test. Also, a fraction of dependent judgments is returned, which should equal the alpha level of the independence test if the test is Uniform under the null hypothesis. For the Faithfulness test, the p-values are tested for Uniformity using the Kolmogorov-Smirnov test; these should be dependent. Also, a fraction of dependent judgments is returned, which should be maximal./p>
A "Markov adequacy score" is also given, which simply returns zero if the Markov p-value Uniformity test fails and the fraction of dependent judgments for the local Faithfulness check otherwise. Maximizing this score picks out models for which Markov holds and faithfulness holds to the extend possible; these model should generally have good accuracy scores.
- Author:
- josephramsey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static enum
The type of conditioning set to use for the Markov check. -
Constructor Summary
ConstructorsConstructorDescriptionMarkovCheck
(Graph graph, IndependenceTest independenceTest, MarkovCheck.ConditioningSetType setType) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Generates all results, for both the local Markov and local Faithfulness checks, for each node in the graph given the parents of that node.static @NotNull MarkovCheck.AllSubsetsIndependenceFacts
double
getFractionDependent
(boolean indep) Returns the fraction of dependent judgments for the given list of results.Returns the independence test being used.double
getKsPValue
(boolean indep) Returns the Kolmorogov-Smirnov p-value for the given list of results.double
getMarkovAdequacyScore
(double alpha) Returns the Markov Adequacy Score for the graph.getPValues
(List<IndependenceResult> results) Returns the list of p-values for the given list of results.getResults
(boolean indep) After the generateResults method has been called, this method returns the results for the local Markov or local Faithfulness check, depending on the value of the indep parameter.Returns type of conditioning sets to use in the Markov check.getVariable
(String name) Returns the variable with the given name.Returns the variables of the independence test.void
setParallelized
(boolean parallelized) True if the checks should be parallelized.void
Sets the type of conditioning sets to use in the Markov check.
-
Constructor Details
-
MarkovCheck
public MarkovCheck(Graph graph, IndependenceTest independenceTest, MarkovCheck.ConditioningSetType setType) Constructor. Takes a graph and an independence test over the variables of the graph.- Parameters:
graph
- The graph.independenceTest
- The test over the variables of the graph.
-
-
Method Details
-
generateResults
public void generateResults()Generates all results, for both the local Markov and local Faithfulness checks, for each node in the graph given the parents of that node. These results are stored in the resultsIndep and resultsDep lists.- See Also:
-
getAllSubsetsIndependenceFacts
@NotNull public static @NotNull MarkovCheck.AllSubsetsIndependenceFacts getAllSubsetsIndependenceFacts(Graph graph) -
getSetType
Returns type of conditioning sets to use in the Markov check.- Returns:
- The type of conditioning sets to use in the Markov check.
- See Also:
-
setSetType
Sets the type of conditioning sets to use in the Markov check.- Parameters:
setType
- The type of conditioning sets to use in the Markov check.- See Also:
-
setParallelized
public void setParallelized(boolean parallelized) True if the checks should be parallelized. (Not always a good idea.)- Parameters:
parallelized
- True if the checks should be parallelized.
-
getResults
After the generateResults method has been called, this method returns the results for the local Markov or local Faithfulness check, depending on the value of the indep parameter.- Parameters:
indep
- True for the local Markov results, false for the local Faithfulness results.- Returns:
- The results for the local Markov or local Faithfulness check.
-
getPValues
Returns the list of p-values for the given list of results.- Parameters:
results
- The results.- Returns:
- Their p-values.
-
getFractionDependent
public double getFractionDependent(boolean indep) Returns the fraction of dependent judgments for the given list of results.- Parameters:
indep
- True for the local Markov results, false for the local Faithfulness results.- Returns:
- The fraction of dependent judgments for this condition.
-
getKsPValue
public double getKsPValue(boolean indep) Returns the Kolmorogov-Smirnov p-value for the given list of results.- Parameters:
indep
- True for the local Markov results, false for the local Faithfulness results.- Returns:
- The Kolmorogov-Smirnov p-value for this condition.
-
getMarkovAdequacyScore
public double getMarkovAdequacyScore(double alpha) Returns the Markov Adequacy Score for the graph. This is zero if the p-value of the KS test of Uniformity is less than alpha, and the fraction of dependent pairs otherwise. This is only for continuous Gaussian data, as it hard-codes the Fisher Z test for the local Markov and Faithfulness check.- Parameters:
alpha
- The alpha level for the KS test of Uniformity. An alpha level greater than this will be considered uniform.- Returns:
- The Markov Adequacy Score for this graph given the data.
-
getVariables
Returns the variables of the independence test.- Returns:
- The variables of the independence test.
-
getVariable
Returns the variable with the given name.- Parameters:
name
- The name of the variables.- Returns:
- The variable with the given name.
-
getIndependenceTest
Returns the independence test being used.- Returns:
- This test.
-