From c7607150f4ba77acc5137f18bb8fdfe9e926f1a6 Mon Sep 17 00:00:00 2001 From: jdramsey Date: Thu, 15 Aug 2024 00:43:47 -0400 Subject: [PATCH 1/3] Refactor and rename methods for PAG consistency Refactor methods and variables to rename "repairFaultyPag" to "guaranteePag" across multiple classes. Added javadoc comments for newly renamed methods and enhanced documentation for better clarity and maintainability. --- .../editor/AbstractSearchEditor.java | 16 ++- .../editor/FactorAnalysisEditor.java | 11 ++ .../model/MissingDataInjectorWrapper.java | 1 + .../ReplaceMissingWithRandomWrapper.java | 9 +- .../edu/cmu/tetradapp/model/SemImWrapper.java | 2 +- .../tetradapp/model/SemUpdaterWrapper.java | 4 +- .../model/StandardizedSemImWrapper.java | 4 +- .../model/StructEmBayesSearchRunner.java | 6 +- .../algorithm/oracle/pag/Bfci.java | 6 +- .../algorithm/oracle/pag/Fci.java | 4 +- .../algorithm/oracle/pag/FciMax.java | 4 +- .../algorithm/oracle/pag/Gfci.java | 2 +- .../algorithm/oracle/pag/GraspFci.java | 2 +- .../algorithm/oracle/pag/LvLite.java | 6 +- .../algorithm/oracle/pag/SpFci.java | 5 +- .../java/edu/cmu/tetrad/graph/GraphUtils.java | 40 +++++-- .../main/java/edu/cmu/tetrad/search/BFci.java | 16 +-- .../main/java/edu/cmu/tetrad/search/Fci.java | 16 +-- .../java/edu/cmu/tetrad/search/FciMax.java | 19 ++-- .../main/java/edu/cmu/tetrad/search/GFci.java | 16 +-- .../java/edu/cmu/tetrad/search/GraspFci.java | 16 +-- .../java/edu/cmu/tetrad/search/LvLite.java | 16 +-- .../java/edu/cmu/tetrad/search/SpFci.java | 16 +-- .../java/edu/cmu/tetrad/search/SvarFci.java | 17 ++- .../edu/cmu/tetrad/search/utils/PcCommon.java | 10 +- .../main/java/edu/cmu/tetrad/util/Params.java | 4 +- .../src/main/resources/docs/manual/index.html | 101 +++++++++++++----- .../edu/cmu/tetrad/test/TestGraphUtils.java | 2 + .../test/java/edu/cmu/tetrad/test/TestPc.java | 6 +- 29 files changed, 238 insertions(+), 139 deletions(-) diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/AbstractSearchEditor.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/AbstractSearchEditor.java index ad0f9dd539..b39cb04321 100644 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/AbstractSearchEditor.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/AbstractSearchEditor.java @@ -483,34 +483,32 @@ GraphHistory getGraphHistory() { } /** - *

getTestType.

- * - * @return a {@link edu.cmu.tetradapp.util.IndTestType} object - */ public IndTestType getTestType() { return (IndTestType) getAlgorithmRunner().getParams().get("indTestType", IndTestType.FISHER_Z); } /** - * {@inheritDoc} + * Sets the test type for the search algorithm. + * + * @param testType The test type to be set. */ public void setTestType(IndTestType testType) { getAlgorithmRunner().getParams().set("indTestType", testType); } /** - *

getDataModel.

+ * Retrieves the data model used to execute the algorithm. * - * @return a {@link edu.cmu.tetrad.data.DataModel} object + * @return the data model used to execute the algorithm, which might possibly be a graph. */ public DataModel getDataModel() { return getAlgorithmRunner().getDataModel(); } /** - *

getSourceGraph.

+ * Retrieves the source graph used for the search algorithm. * - * @return a {@link java.lang.Object} object + * @return the source graph used for the search algorithm, or null if not set. */ public Object getSourceGraph() { return getAlgorithmRunner().getParams().get("sourceGraph", null); diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/FactorAnalysisEditor.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/FactorAnalysisEditor.java index 68274b06b9..50cfb06214 100644 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/FactorAnalysisEditor.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/FactorAnalysisEditor.java @@ -24,6 +24,7 @@ import edu.cmu.tetrad.graph.Graph; import edu.cmu.tetrad.graph.LayoutUtil; import edu.cmu.tetradapp.model.FactorAnalysisRunner; +import edu.cmu.tetradapp.util.IndTestType; import edu.cmu.tetradapp.workbench.GraphWorkbench; import javax.swing.*; @@ -132,6 +133,16 @@ protected void addSpecialMenus(JMenuBar menuBar) { } + /** + * This method is called when the user selects "Save As..." from the File menu. + * + * @throws UnsupportedOperationException since this method is not supported by this class. + */ + @Override + public IndTestType getTestType() { + throw new UnsupportedOperationException("Not supported yet."); + } + /** *

getSourceGraph.

* diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/MissingDataInjectorWrapper.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/MissingDataInjectorWrapper.java index c1f2f501a7..9557d2b43b 100755 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/MissingDataInjectorWrapper.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/MissingDataInjectorWrapper.java @@ -42,6 +42,7 @@ * @version $Id: $Id */ public class MissingDataInjectorWrapper extends DataWrapper { + @Serial private static final long serialVersionUID = 23L; /** diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/ReplaceMissingWithRandomWrapper.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/ReplaceMissingWithRandomWrapper.java index 1f0a9a87ac..4a5518e8a2 100755 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/ReplaceMissingWithRandomWrapper.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/ReplaceMissingWithRandomWrapper.java @@ -43,11 +43,6 @@ public class ReplaceMissingWithRandomWrapper extends DataWrapper { @Serial private static final long serialVersionUID = 23L; - /** - * @serial Cannot be null. - */ - private final DataSet outputDataSet; - //============================CONSTRUCTORS=============================// /** @@ -59,8 +54,8 @@ public ReplaceMissingWithRandomWrapper(DataWrapper wrapper) { DataSet dataSet = (DataSet) wrapper.getSelectedDataModel(); - this.outputDataSet = DataTransforms.replaceMissingWithRandom(dataSet); - setDataModel(this.outputDataSet); + DataSet outputDataSet = DataTransforms.replaceMissingWithRandom(dataSet); + setDataModel(outputDataSet); setSourceGraph(wrapper.getSourceGraph()); LogDataUtils.logDataModelList("Parent data with missing values injected randomly.", getDataModelList()); diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemImWrapper.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemImWrapper.java index 99a183c3d8..c5f02f17b4 100644 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemImWrapper.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemImWrapper.java @@ -55,7 +55,7 @@ public class SemImWrapper implements SessionModel { private List semIms; /** - * @serial Can be null. + * The name of the model. */ private String name; diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemUpdaterWrapper.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemUpdaterWrapper.java index 1c27615d73..595c6c6f18 100644 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemUpdaterWrapper.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/SemUpdaterWrapper.java @@ -42,12 +42,12 @@ public class SemUpdaterWrapper implements SessionModel { private static final long serialVersionUID = 23L; /** - * @serial + * The wrapped Bayes Updater. */ private final SemUpdater semUpdater; /** - * @serial Can be null. + * The name of the model. */ private String name; diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StandardizedSemImWrapper.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StandardizedSemImWrapper.java index 7ee60128b4..9b152ad268 100644 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StandardizedSemImWrapper.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StandardizedSemImWrapper.java @@ -44,11 +44,11 @@ public class StandardizedSemImWrapper implements KnowledgeBoxInput { private static final long serialVersionUID = 23L; /** - * @serial Cannot be null. + * The wrapped standardized SEM IM. */ private final StandardizedSemIm standardizedSemIm; /** - * @serial Can be null. + * The name of the model. */ private String name; /** diff --git a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StructEmBayesSearchRunner.java b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StructEmBayesSearchRunner.java index a0c7d38781..02f2ac4bb5 100644 --- a/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StructEmBayesSearchRunner.java +++ b/tetrad-gui/src/main/java/edu/cmu/tetradapp/model/StructEmBayesSearchRunner.java @@ -52,17 +52,17 @@ public class StructEmBayesSearchRunner implements SessionModel, GraphSource { private String name; /** - * @serial Cannot be null. + * The Bayes PM. */ private BayesPm bayesPm; /** - * @serial Cannot be null. + * The data set. */ private DataSet dataSet; /** - * @serial Cannot be null. + * The estimated Bayes IM. */ private BayesIm estimatedBayesIm; diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Bfci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Bfci.java index b647b3e8be..b3831a7986 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Bfci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Bfci.java @@ -45,7 +45,7 @@ algoType = AlgType.allow_latent_common_causes ) @Bootstrapping -@Experimental +//@Experimental public class Bfci extends AbstractBootstrapAlgorithm implements Algorithm, UsesScoreWrapper, TakesIndependenceWrapper, HasKnowledge, ReturnsBootstrapGraphs, TakesCovarianceMatrix { @@ -119,7 +119,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { search.setDoDiscriminatingPathColliderRule(parameters.getBoolean(Params.DO_DISCRIMINATING_PATH_COLLIDER_RULE)); search.setDepth(parameters.getInt(Params.DEPTH)); search.setNumThreads(parameters.getInt(Params.NUM_THREADS)); - search.setRepairFaultyPag(parameters.getBoolean(Params.REPAIR_FAULTY_PAG)); + search.setGuaranteePag(parameters.getBoolean(Params.GUARANTEE_PAG)); search.setVerbose(parameters.getBoolean(Params.VERBOSE)); search.setKnowledge(knowledge); @@ -182,7 +182,7 @@ public List getParameters() { params.add(Params.TIME_LAG); params.add(Params.SEED); params.add(Params.NUM_THREADS); - params.add(Params.REPAIR_FAULTY_PAG); + params.add(Params.GUARANTEE_PAG); params.add(Params.VERBOSE); // Parameters diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Fci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Fci.java index 6fcb9df5c0..3ed6555753 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Fci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Fci.java @@ -110,7 +110,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { search.setVerbose(parameters.getBoolean(Params.VERBOSE)); search.setPcHeuristicType(pcHeuristicType); search.setStable(parameters.getBoolean(Params.STABLE_FAS)); - search.setRepairFaultyPag(parameters.getBoolean(Params.REPAIR_FAULTY_PAG)); + search.setGuaranteePag(parameters.getBoolean(Params.GUARANTEE_PAG)); return search.search(); } @@ -164,7 +164,7 @@ public List getParameters() { parameters.add(Params.DO_DISCRIMINATING_PATH_COLLIDER_RULE); parameters.add(Params.COMPLETE_RULE_SET_USED); parameters.add(Params.TIME_LAG); - parameters.add(Params.REPAIR_FAULTY_PAG); + parameters.add(Params.GUARANTEE_PAG); parameters.add(Params.VERBOSE); diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/FciMax.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/FciMax.java index 5ebac13b12..60500f4362 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/FciMax.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/FciMax.java @@ -108,7 +108,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { search.setDoDiscriminatingPathColliderRule(parameters.getBoolean(Params.DO_DISCRIMINATING_PATH_COLLIDER_RULE)); search.setPossibleMsepSearchDone(parameters.getBoolean(Params.POSSIBLE_MSEP_DONE)); search.setPcHeuristicType(pcHeuristicType); - search.setRepairFaultyPag(parameters.getBoolean(Params.REPAIR_FAULTY_PAG)); + search.setGuaranteePag(parameters.getBoolean(Params.GUARANTEE_PAG)); search.setVerbose(parameters.getBoolean(Params.VERBOSE)); return search.search(); @@ -160,7 +160,7 @@ public List getParameters() { parameters.add(Params.DO_DISCRIMINATING_PATH_TAIL_RULE); parameters.add(Params.DO_DISCRIMINATING_PATH_COLLIDER_RULE); parameters.add(Params.POSSIBLE_MSEP_DONE); - parameters.add(Params.REPAIR_FAULTY_PAG); + parameters.add(Params.GUARANTEE_PAG); // parameters.add(Params.PC_HEURISTIC); parameters.add(Params.TIME_LAG); diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Gfci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Gfci.java index 37214de1c6..1af8ee0edb 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Gfci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/Gfci.java @@ -105,7 +105,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { search.setDoDiscriminatingPathTailRule(parameters.getBoolean(Params.DO_DISCRIMINATING_PATH_TAIL_RULE)); search.setDoDiscriminatingPathColliderRule(parameters.getBoolean(Params.DO_DISCRIMINATING_PATH_COLLIDER_RULE)); search.setNumThreads(parameters.getInt(Params.NUM_THREADS)); - search.setRepairFaultyPag(parameters.getBoolean(Params.REMOVE_ALMOST_CYCLES)); + search.setGuaranteePag(parameters.getBoolean(Params.REMOVE_ALMOST_CYCLES)); search.setOut(System.out); return search.search(); diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/GraspFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/GraspFci.java index 432d6cd028..e68197ef71 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/GraspFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/GraspFci.java @@ -132,7 +132,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { // General search.setVerbose(parameters.getBoolean(Params.VERBOSE)); - search.setRepairFaultyPag(parameters.getBoolean(Params.REMOVE_ALMOST_CYCLES)); + search.setGuaranteePag(parameters.getBoolean(Params.REMOVE_ALMOST_CYCLES)); search.setKnowledge(this.knowledge); return search.search(); diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/LvLite.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/LvLite.java index 57b95581f3..dc7bcf4db7 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/LvLite.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/LvLite.java @@ -43,7 +43,7 @@ algoType = AlgType.allow_latent_common_causes ) @Bootstrapping -@Experimental +//@Experimental public class LvLite extends AbstractBootstrapAlgorithm implements Algorithm, UsesScoreWrapper, TakesIndependenceWrapper, HasKnowledge, ReturnsBootstrapGraphs, TakesCovarianceMatrix { @@ -153,7 +153,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { search.setDepth(parameters.getInt(Params.DEPTH)); search.setMaxDdpPathLength(parameters.getInt(Params.MAX_PATH_LENGTH)); search.setTestTimeout(parameters.getLong(Params.TEST_TIMEOUT)); - search.setRepairFaultyPag(parameters.getBoolean(Params.REPAIR_FAULTY_PAG)); + search.setGuaranteePag(parameters.getBoolean(Params.GUARANTEE_PAG)); // Ablation search.setAblationLeaveOutScoringStep(parameters.getBoolean(Params.ABLATION_LEAVE_OUT_SCORING_STEP)); @@ -233,7 +233,7 @@ public List getParameters() { params.add(Params.ABLATION_LEAVE_OUT_SCORING_STEP); params.add(Params.ABLATION_LEAVE_OUT_TESTING_STEPS); params.add(Params.MAX_PATH_LENGTH); - params.add(Params.REPAIR_FAULTY_PAG); + params.add(Params.GUARANTEE_PAG); // General params.add(Params.TIME_LAG); diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/SpFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/SpFci.java index f349f04415..89a0ea33d3 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/SpFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/algcomparison/algorithm/oracle/pag/SpFci.java @@ -21,7 +21,6 @@ import edu.cmu.tetrad.util.Parameters; import edu.cmu.tetrad.util.Params; -import java.io.PrintStream; import java.io.Serial; import java.util.ArrayList; import java.util.List; @@ -114,7 +113,7 @@ public Graph runSearch(DataModel dataModel, Parameters parameters) { search.setCompleteRuleSetUsed(parameters.getBoolean(Params.COMPLETE_RULE_SET_USED)); search.setDoDiscriminatingPathColliderRule(parameters.getBoolean(Params.DO_DISCRIMINATING_PATH_COLLIDER_RULE)); search.setDoDiscriminatingPathTailRule(parameters.getBoolean(Params.DO_DISCRIMINATING_PATH_TAIL_RULE)); - search.setRepairFaultyPag(parameters.getBoolean(Params.REPAIR_FAULTY_PAG)); + search.setGuaranteePag(parameters.getBoolean(Params.GUARANTEE_PAG)); search.setVerbose(parameters.getBoolean(Params.VERBOSE)); search.setOut(System.out); @@ -170,7 +169,7 @@ public List getParameters() { params.add(Params.DO_DISCRIMINATING_PATH_TAIL_RULE); params.add(Params.DEPTH); params.add(Params.TIME_LAG); - params.add(Params.REPAIR_FAULTY_PAG); + params.add(Params.GUARANTEE_PAG); params.add(Params.VERBOSE); // Flags diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java index 2798ecaeb6..a07a45ee71 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java @@ -2523,7 +2523,7 @@ public static Graph convert(String spec) { * @param sepsets The sepsets used to determine the orientation of edges. * @param knowledge The knowledge used to determine the orientation of edges. * @param verbose Whether to print verbose output. - * @param unshieldedTriples + * @param unshieldedTriples A set to store unshielded triples. */ public static void gfciR0(Graph pag, Graph cpdag, SepsetProducer sepsets, Knowledge knowledge, boolean verbose, Set unshieldedTriples) { @@ -2891,7 +2891,7 @@ public static boolean isCorrectBidirectedEdge(Edge edge, Graph trueGraph) { } /** - * Repairs a faulty PAG (Partially Directed Acyclic Graph). + * Guarantees a legal PAG by repairing deviations of a graph from a legal PAG (partial ancestral graph). *

* Two types of repairs are attempted. First, if there is an edge x <-> y with a path x ~~> y, then the * unshielded colldiers into x are removed and the graph is rebuilt. @@ -2909,10 +2909,11 @@ public static boolean isCorrectBidirectedEdge(Edge edge, Graph trueGraph) { * @param unshieldedColliders the set of unshielded colliders to be updated * @param checkCyclicity indicates whether or not to check for cyclicity * @param verbose indicates whether or not to print verbose output + * @return the repaired PAG * @throws IllegalArgumentException if the estimated PAG contains a directed cycle */ - public static Graph repairFaultyPag(Graph pag, FciOrient fciOrient, Knowledge knowledge, - Set unshieldedColliders, boolean checkCyclicity, boolean verbose) { + public static Graph guaranteePag(Graph pag, FciOrient fciOrient, Knowledge knowledge, + Set unshieldedColliders, boolean checkCyclicity, boolean verbose) { if (verbose) { TetradLogger.getInstance().log("Repairing faulty PAG..."); } @@ -3397,6 +3398,16 @@ private static void dsepFollowPath2(Node a, Node x, Node y, Set dsep, Set< path.remove(a); } + /** + * Removes almost cycles from a graph. + * + * @param unshieldedColliders a set of unshielded colliders + * @param fciOrient the FciOrient object + * @param pag the graph + * @param knowledge the knowledge base + * @param verbose a flag indicating whether to log verbose output + * @return true if any change was made to the graph, false otherwise + */ public static boolean removeAlmostCycles2(Set unshieldedColliders, FciOrient fciOrient, Graph pag, Knowledge knowledge, boolean verbose) { if (verbose) { @@ -3516,6 +3527,16 @@ public static boolean removeAlmostCycles2(Set unshieldedColliders, FciOr return anyChange; } + /** + * Removes cycles from the given graph using the Fast Causal Inference (FCI) algorithm. + * + * @param unshieldedColliders the set of unshielded colliders. + * @param fciOrient the FciOrient object used for orientation + * @param pag the graph to remove cycles from + * @param knowledge the knowledge base used by the FCI algorithm + * @param verbose a flag indicating whether to log verbose information + * @return true if any cycles were removed, false otherwise + */ public static boolean removeCycles(Set unshieldedColliders, FciOrient fciOrient, Graph pag, Knowledge knowledge, boolean verbose) { if (verbose) { @@ -3678,10 +3699,11 @@ public static boolean triple(Graph graph, Node a, Node b, Node c) { /** * Determines if the collider is allowed. * - * @param pag The Graph representing the PAG. - * @param x The Node object representing the first node. - * @param b The Node object representing the second node. - * @param y The Node object representing the third node. + * @param pag The Graph representing the PAG. + * @param x The Node object representing the first node. + * @param b The Node object representing the second node. + * @param y The Node object representing the third node. + * @param knowledge The Knowledge object. * @return true if the collider is allowed, false otherwise. */ public static boolean colliderAllowed(Graph pag, Node x, Node b, Node y, Knowledge knowledge) { @@ -3694,6 +3716,8 @@ public static boolean colliderAllowed(Graph pag, Node x, Node b, Node y, Knowled * @param fciOrient The FciOrient object used for orienting the edges. * @param pag The Graph representing the PAG. * @param best The list of Node objects representing the best nodes. + * @param knowledge The Knowledge object. + * @param verbose A boolean value indicating whether verbose output should be printed. */ public static void doRequiredOrientations(FciOrient fciOrient, Graph pag, List best, Knowledge knowledge, boolean verbose) { if (verbose) { diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/BFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/BFci.java index 91cc05ff1d..4a21d4746c 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/BFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/BFci.java @@ -133,9 +133,9 @@ public final class BFci implements IGraphSearch { */ private boolean verbose; /** - * Whether to repair a faulty PAG. + * Whether to guarantee the output is a PAG by repairing a faulty PAG. */ - private boolean repairFaultyPag; + private boolean guaranteePag; /** * Whether to leave out the final orientation step. */ @@ -222,8 +222,8 @@ public Graph search() { GraphUtils.replaceNodes(graph, this.independenceTest.getVariables()); - if (repairFaultyPag) { - graph = GraphUtils.repairFaultyPag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); + if (guaranteePag) { + graph = GraphUtils.guaranteePag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); } return graph; @@ -346,12 +346,12 @@ public void setNumThreads(int numThreads) { } /** - * Sets whether to repair a faulty PAG. + * Sets whether to guarantee the output is a PAG by repairing a faulty PAG. * - * @param repairFaultyPag True if a faulty PAG should be repaired, false otherwise. + * @param guaranteePag True if a faulty PAG should be repaired, false otherwise. */ - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } /** diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/Fci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/Fci.java index 08e84e80ec..57ce491c8f 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/Fci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/Fci.java @@ -125,9 +125,9 @@ public final class Fci implements IGraphSearch { */ private boolean doDiscriminatingPathColliderRule = true; /** - * Whether the PAG should be repaired. + * Whether the output should be guaranteed to be a PAG. */ - private boolean repairFaultyPag; + private boolean guaranteePag; /** * Whether the final orientation step should be left out. */ @@ -268,8 +268,8 @@ public Graph search() { fciOrient.finalOrientation(graph); } - if (repairFaultyPag) { - graph = GraphUtils.repairFaultyPag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); + if (guaranteePag) { + graph = GraphUtils.guaranteePag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); } long stop = MillisecondTimes.timeMillis(); @@ -421,12 +421,12 @@ public void setDoDiscriminatingPathColliderRule(boolean doDiscriminatingPathColl } /** - * Sets whether the PAG should be repaired if faulty. + * Sets whether to guarantee the output is a PAG by repairing a faulty PAG. * - * @param repairFaultyPag True, if so. + * @param guaranteePag True, if so. */ - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } /** diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/FciMax.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/FciMax.java index 1b06e50719..35380d755a 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/FciMax.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/FciMax.java @@ -25,8 +25,8 @@ import edu.cmu.tetrad.graph.*; import edu.cmu.tetrad.search.test.IndependenceResult; import edu.cmu.tetrad.search.utils.FciOrient; -import edu.cmu.tetrad.search.utils.R0R4StrategyTestBased; import edu.cmu.tetrad.search.utils.PcCommon; +import edu.cmu.tetrad.search.utils.R0R4StrategyTestBased; import edu.cmu.tetrad.search.utils.SepsetMap; import edu.cmu.tetrad.util.ChoiceGenerator; import edu.cmu.tetrad.util.MillisecondTimes; @@ -128,7 +128,7 @@ public final class FciMax implements IGraphSearch { * Whether the final orientation step should be left out. */ private boolean ablationLeaveOutFinalOrientation = false; - private boolean repairFaultyPag; + private boolean guaranteePag; /** * Constructor. @@ -197,8 +197,8 @@ public Graph search() { fciOrient.finalOrientation(graph); } - if (repairFaultyPag) { - graph = GraphUtils.repairFaultyPag(graph, fciOrient, knowledge, unshieldedColldiders, false, verbose); + if (guaranteePag) { + graph = GraphUtils.guaranteePag(graph, fciOrient, knowledge, unshieldedColldiders, false, verbose); } long stop = MillisecondTimes.timeMillis(); @@ -344,7 +344,7 @@ public void setDoDiscriminatingPathTailRule(boolean doDiscriminatingPathTailRule /** * Adds colliders to the given graph. * - * @param graph The graph to which colliders should be added. + * @param graph The graph to which colliders should be added. * @param unshieldedColliders */ private void addColliders(Graph graph, Set unshieldedColliders) { @@ -497,8 +497,13 @@ public void setLeaveOutFinalOrientation(boolean ablationLeaveOutFinalOrientation this.ablationLeaveOutFinalOrientation = ablationLeaveOutFinalOrientation; } - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + /** + * Sets whether to guarantee a PAG. + * + * @param guaranteePag true to guarantee a PAG, false otherwise. + */ + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } } diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java index 2e1182f56b..92cf0d1eab 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java @@ -122,9 +122,9 @@ public final class GFci implements IGraphSearch { */ private boolean doDiscriminatingPathColliderRule = true; /** - * Whether to repair faulty PAGs. + * Whether to guarantee the output is a PAG by repairing a faulty PAG. */ - private boolean repairFaultyPag = false; + private boolean guaranteePag = false; /** * Whether to leave out the final orientation step in the ablation study. */ @@ -218,8 +218,8 @@ public Graph search() { fciOrient.finalOrientation(graph); } - if (repairFaultyPag) { - graph = GraphUtils.repairFaultyPag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); + if (guaranteePag) { + graph = GraphUtils.guaranteePag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); } return graph; @@ -345,12 +345,12 @@ public void setNumThreads(int numThreads) { /** - * Sets the flag indicating whether to repair faulty PAG. + * Sets the flag indicating whether to guarantee the output is a legal PAG. * - * @param repairFaultyPag A boolean value indicating whether to repair faulty PAG. + * @param guaranteePag A boolean value indicating whether to guarantee the output is a legal PAG. */ - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } /** diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GraspFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GraspFci.java index d3c502c71a..fa5ea04385 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GraspFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GraspFci.java @@ -132,9 +132,9 @@ public final class GraspFci implements IGraphSearch { */ private boolean verbose = false; /** - * The flag for whether to repair a faulty PAG. + * The flag for whether to guarantee the output is a legal PAG. */ - private boolean repairFaultyPag = false; + private boolean guaranteePag = false; /** * Whether to leave out the final orientation step. */ @@ -227,8 +227,8 @@ public Graph search() { fciOrient.finalOrientation(pag); } - if (repairFaultyPag) { - pag = GraphUtils.repairFaultyPag(pag, fciOrient, knowledge, unshieldedTriples, false, verbose); + if (guaranteePag) { + pag = GraphUtils.guaranteePag(pag, fciOrient, knowledge, unshieldedTriples, false, verbose); } GraphUtils.replaceNodes(pag, this.independenceTest.getVariables()); @@ -378,12 +378,12 @@ public void setDepth(int depth) { } /** - * Sets the flag for whether to repair a faulty PAG. + * Sets the flag for whether to guarantee the output is a legal PAG. * - * @param repairFaultyPag True, if so. + * @param guaranteePag True, if so. */ - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } /** diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/LvLite.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/LvLite.java index c38d57f579..2cc8e67d6e 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/LvLite.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/LvLite.java @@ -62,9 +62,9 @@ public final class LvLite implements IGraphSearch { */ private START_WITH startWith = START_WITH.BOSS; /** - * Flag indicating whether to repair a faulty PAG. + * Flag indicating the output should be guaranteed to be a PAG. */ - private boolean repairFaultyPag = false; + private boolean guaranteePag = false; /** * The number of starts for GRaSP. */ @@ -368,8 +368,8 @@ public Graph search() { TetradLogger.getInstance().log("Finished implied orientation."); } - if (repairFaultyPag) { - pag = GraphUtils.repairFaultyPag(pag, fciOrient, knowledge, unshieldedColliders, false, verbose); + if (guaranteePag) { + pag = GraphUtils.guaranteePag(pag, fciOrient, knowledge, unshieldedColliders, false, verbose); } if (verbose) { @@ -461,12 +461,12 @@ public void setRecursionDepth(int recursionDepth) { } /** - * Sets whether to repair a faulty PAG. + * Sets whether to guarantee a PAG output by repairing a faulty PAG. * - * @param repairFaultyPag true if a faulty PAGs should be repaired, false otherwise + * @param guaranteePag true if a faulty PAGs should be repaired, false otherwise */ - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } /** diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SpFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SpFci.java index bb9250cabd..d145df542c 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SpFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SpFci.java @@ -105,9 +105,9 @@ public final class SpFci implements IGraphSearch { */ private boolean verbose; /** - * True iff the search should repair a faulty PAG. + * True iff the search should guarantee a PAG output. */ - private boolean repairFaultyPag = false; + private boolean guaranteePag = false; /** * The method to use for finding sepsets, 1 = greedy, 2 = min-p., 3 = max-p, default min-p. */ @@ -182,8 +182,8 @@ public Graph search() { GraphUtils.replaceNodes(graph, this.independenceTest.getVariables()); - if (repairFaultyPag) { - graph = GraphUtils.repairFaultyPag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); + if (guaranteePag) { + graph = GraphUtils.guaranteePag(graph, fciOrient, knowledge, unshieldedTriples, false, verbose); } return graph; @@ -308,12 +308,12 @@ public void setDepth(int depth) { } /** - * Sets whether the search should repair a faulty PAG. + * Sets whether the search should guarantee the output is a legal PAG. * - * @param repairFaultyPag True, if so. + * @param guaranteePag True, if so. */ - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } /** diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SvarFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SvarFci.java index cd9b6276b4..37544c66d0 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SvarFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/SvarFci.java @@ -96,7 +96,7 @@ public final class SvarFci implements IGraphSearch { * Represents whether to resolve almost cyclic paths during the search. */ private boolean resolveAlmostCyclicPaths; - private boolean repairFaultyPag; + private boolean guaranteePag; /** * Constructs a new FCI search for the given independence test and background knowledge. @@ -212,8 +212,8 @@ public Graph search(IFas fas) { fciOrient.ruleR0(this.graph, unshieldedTriples); fciOrient.finalOrientation(this.graph); - if (repairFaultyPag) { - this.graph = GraphUtils.repairFaultyPag(this.graph, fciOrient, knowledge, unshieldedTriples, false, verbose); + if (guaranteePag) { + this.graph = GraphUtils.guaranteePag(this.graph, fciOrient, knowledge, unshieldedTriples, false, verbose); } if (resolveAlmostCyclicPaths) { @@ -514,8 +514,15 @@ public void setResolveAlmostCyclicPaths(boolean resolveAlmostCyclicPaths) { this.resolveAlmostCyclicPaths = resolveAlmostCyclicPaths; } - public void setRepairFaultyPag(boolean repairFaultyPag) { - this.repairFaultyPag = repairFaultyPag; + /** + * Sets whether a guaranteed partial ancestral graph (PAG) should be built during the search. When set to true, the + * search algorithm will construct a PAG even if it cannot guarantee its correctness. When set to false, the search + * algorithm may return a PAG that is not fully connected or has other inconsistencies. + * + * @param guaranteePag true to guarantee the construction of a PAG, false otherwise + */ + public void setGuaranteePag(boolean guaranteePag) { + this.guaranteePag = guaranteePag; } } diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/PcCommon.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/PcCommon.java index 5627660048..76232b6981 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/PcCommon.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/PcCommon.java @@ -352,8 +352,14 @@ public Graph search(List nodes) { this.graph = GraphUtils.replaceNodes(this.graph, nodes); if (guaranteeCpdag) { - GraphTransforms.dagFromCpdag(this.graph, true); - graph = GraphTransforms.dagToCpdag(this.graph); + MeekRules meekRules = new MeekRules(); + meekRules.setKnowledge(this.knowledge); + meekRules.setVerbose(verbose); + meekRules.setMeekPreventCycles(true); + meekRules.orientImplied(this.graph); + +// GraphTransforms.dagFromCpdag(this.graph, true); +// graph = GraphTransforms.dagToCpdag(this.graph); } else { MeekRules meekRules = new MeekRules(); meekRules.setKnowledge(this.knowledge); diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/util/Params.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/util/Params.java index 9f26229f99..a9817c49a7 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/util/Params.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/util/Params.java @@ -904,9 +904,9 @@ public final class Params { */ public static final String MAX_SCORE_DROP = "maxScoreDrop"; /** - * Constant REPAIR_FAULTY_PAG="repairFaultyPag" + * Constant GUARANTEE_PAG="guaranteePag" */ - public static final String REPAIR_FAULTY_PAG = "repairFaultyPag"; + public static final String GUARANTEE_PAG = "guaranteePag"; /** * Constant REMOVE_ALMOST_CYCLES="removeAlmostCycles" */ diff --git a/tetrad-lib/src/main/resources/docs/manual/index.html b/tetrad-lib/src/main/resources/docs/manual/index.html index 65f934f710..91afb22a02 100755 --- a/tetrad-lib/src/main/resources/docs/manual/index.html +++ b/tetrad-lib/src/main/resources/docs/manual/index.html @@ -3130,24 +3130,70 @@

Parameters

GRaSP.

+

The LV-Lite Algorithm

+ +

Description

+ +
+

LV-Lite starts with BOSS or GRaSP and get a valid order and a DAG/CPDAG. It sets the initial state of the + estimted PAG to this CPDAG and orients as o-o and then copy all of the unshielded colliders from the CPDAG + to the PAG. It then performs a testing modified from the step in GFCI that is more efficient. In GFCI, an + edge x *-* y is removed from the graph is there is a subset S of adj(x) \ {y} or adj(y) \ {x} such that x + _||_ y | S. For LV-Lite we instead search outward from x for a set S using a novel procedure that blocks all + existing paths in the estimated PAG either unconditionally or conditionally. Bounds may be placed on the + lengths of the blocked paths to consider and the depth (maximum |S|). We also allow bounds on the time + spent on any testing step. As edges are removed in this way, any additional colliders are oriented given + these sepsets S. We then run the final FCI orientation rules, where for the discriminating path rule we use + the same "out of x" sepset finding idea. We optionally allow the user to request that a legal PAG be + returned using a novel procedure; this guarantee has been extended to all latent variable algorithms in + Tetrad that return partial ancestral graphs (PAGs). +

+ +

LV-Lite, along with BFCI, can produce highly accurate models in simulation. LV-Lite, in particular, is highly + scalable. A paper describing BFCI and LV-Lite in more detail is planned. We make both BFCI and LV-Lite + non-experimental for this version since requests have been made to use them.

+

+ +

Note: If one wants to analyze time series data using this algorithm, one may set the time lag parameter to a + value greater than 0, which will automatically apply the time lag transform. The same goes for any algorithm + that has this parameter available in the interface.

+
+ + +

Input Assumptions

+ +

Same as for FCI.

+ +

Output Format

+ +

Same as for FCI.

+ +

Parameters

+ +

Uses all of the parameters of FCI (see Spirtes et al., 1993) and + GRaSP.

+

The BFCI Algorithm

Description

Uses BOSS in place of FGES for the initial step in the GFCI algorithm. This tends to produce a accurate PAG - than GFCI - as a result, for the latent variables case. This is a simple substitution; the reference for GFCI is - here:

+ than GFCI as a result, for the latent variables case. This is a simple substitution; the reference for GFCI + is here:

J.M. Ogarrio and P. Spirtes and J. Ramsey, "A Hybrid Causal Search Algorithm for Latent Variable Models," - JMLR 2016. - Here, BOSS has been substituted for FGES.

+ JMLR 2016. Here, BOSS has been substituted for FGES.

For BOSS only a score is needed, but there are steps in GFCI that require a test, so for this method, both a - test and - a score need to be given.

+ test and a score need to be given. The reference for BOSS is:

+

Andrews, B., Ramsey, J., Sanchez Romero, R., Camchong, J., & Kummerfeld, E. (2023). Fast scalable and + accurate discovery of dags using the best order score search and grow shrink trees. Advances in Neural + Information Processing Systems, 36, 63945-63956.

This class is configured to respect knowledge of forbidden and required edges, including knowledge of - temporal - tiers.

+ temporal tiers.

+

LV-Lite, along with BFCI, can produce highly accurate models in simulation. LV-Lite, in particular, is highly + scalable. A paper describing BFCI and LV-Lite in more detail is planned. We make both BFCI and LV-Lite + non-experimental for this version since requests have been made to use them.

+

Note: If one wants to analyze time series data using this algorithm, one may set the time lag parameter to a value greater than 0, which @@ -4748,7 +4794,7 @@

Zhang-Shen Bound Score

id="removeEffectNodes_long_desc">True if effect nodes should be removed from possible causes
  • Default Value: True
  • + id="removeEffectNodes_default_value">true
  • Lower Bound:
  • Upper Bound: coefLow
    • Short Description: - Yes if the output should guarantee a CPDAG
    • + Guarantee that the output is a legal CPDAG
    • Long Description: It is possible due to unfaithfulness for the Meek rules to output a non-CPDAG; this parameter guarantees a CPDAG if set to 'Yes'.
    • Default Value: true
    • + id="guaranteeCpdag_default_value">false
    • Lower Bound:
    • Upper Bound: ia class="parameter_description_list">
    • Short Description: - The method to use for finding sepsets, 1 = Greedy, 2 = Min-p, 3 = Max-p (default).
    • + The method to use for finding sepsets, 1 = Greedy, 2 = Min-p, 3 = Max-p (default). +
    • Long Description: - The method to use for finding sepsets, 1 = Greedy, 2 = Min-p, 3 = Max-p (default).
    • + The method to use for finding sepsets, 1 = Greedy, 2 = Min-p, 3 = Max-p (default). +
    • Default Value: 3
    • Lower Bound: ia

    repairFaultyPag

    + id="guaranteePag">guaranteePag
    • Short Description: - Yes if repairs should be made to a faulty PAG + id="guaranteePag_short_desc"> + Guarantee that the output is a legal PAG
    • Long Description: + id="guaranteePag_long_desc"> Repairs errors in PAGs due to almost cyclic paths or non-maximalities. + This comes with a certain risk; errors in PAGs indicate that the PAG + assumptions were not met; the user may wish to consider why before + selecting this option.
    • Default Value: False
    • + id="guaranteePag_default_value">false
    • Lower Bound:
    • + id="guaranteePag_lower_bound">
    • Upper Bound:
    • + id="guaranteePag_upper_bound">
    • Value Type: Boolean
    • + id="guaranteePag_value_type">Boolean

    ia

    rebuilds the PAG.
  • Default Value: False
  • + id="removeAlmostCycles_default_value">false
  • Lower Bound:
  • Upper @@ -6702,7 +6753,7 @@

    ia

    If true, the final orientation step of the algorithm is not performed.
  • Default Value: False
  • + id="ablationLeaveOutFinalOrientation_default_value">false
  • Lower Bound:
  • Upper @@ -7788,7 +7839,7 @@

    useBes

    id="useBes_long_desc">This algorithm can use the backward equivalence search from the GES algorithm as one of its steps.
  • Default Value: False
  • + id="useBes_default_value">false
  • Lower Bound:
  • Upper Bound: unshieldedTriples = new HashSet<>(); + FciOrient fciOrientation = new FciOrient(R0R4StrategyTestBased.defaultConfiguration(graph, knowledge)); fciOrientation.orient(_graph, unshieldedTriples); diff --git a/tetrad-lib/src/test/java/edu/cmu/tetrad/test/TestPc.java b/tetrad-lib/src/test/java/edu/cmu/tetrad/test/TestPc.java index 9ceb1eef02..5ca1916f9a 100644 --- a/tetrad-lib/src/test/java/edu/cmu/tetrad/test/TestPc.java +++ b/tetrad-lib/src/test/java/edu/cmu/tetrad/test/TestPc.java @@ -127,9 +127,9 @@ public void testCites() { "\n" + "Graph Edges:\n" + "1. ABILITY --> CITES\n" + - "2. ABILITY --- GPQ\n" + - "3. ABILITY --- PREPROD\n" + - "4. GPQ --- QFJ\n" + + "2. ABILITY --> GPQ\n" + + "3. ABILITY --> PREPROD\n" + + "4. GPQ --> QFJ\n" + "5. PREPROD --> CITES\n" + "6. PUBS --> CITES\n" + "7. QFJ --> CITES\n" + From 5ec79934b10d0041c3d4c993cae4542dca62bf03 Mon Sep 17 00:00:00 2001 From: jdramsey Date: Thu, 15 Aug 2024 01:00:30 -0400 Subject: [PATCH 2/3] Switch version from 7.6.5-SNAPSHOT to 7.6.5 Updated the version in multiple POM files to move from the 7.6.5-SNAPSHOT development version to the 7.6.5 release version. This change ensures the project dependencies align with the stable release. Also, improved the Javadoc for the `ruleR0` method in `FciOrient.java` for better clarity. --- data-reader/pom.xml | 2 +- pom.xml | 2 +- tetrad-gui/dependency-reduced-pom.xml | 2 +- tetrad-gui/pom.xml | 2 +- tetrad-lib/dependency-reduced-pom.xml | 2 +- tetrad-lib/pom.xml | 2 +- .../src/main/java/edu/cmu/tetrad/search/utils/FciOrient.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data-reader/pom.xml b/data-reader/pom.xml index 2992dbb1d5..6abadf8c40 100644 --- a/data-reader/pom.xml +++ b/data-reader/pom.xml @@ -5,7 +5,7 @@ io.github.cmu-phil tetrad - 7.6.5-SNAPSHOT + 7.6.5 data-reader diff --git a/pom.xml b/pom.xml index c970a04c41..455314538c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.github.cmu-phil tetrad - 7.6.5-SNAPSHOT + 7.6.5 pom Tetrad Project diff --git a/tetrad-gui/dependency-reduced-pom.xml b/tetrad-gui/dependency-reduced-pom.xml index e677b4f99a..f556162c5e 100644 --- a/tetrad-gui/dependency-reduced-pom.xml +++ b/tetrad-gui/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ tetrad io.github.cmu-phil - 7.6.5-SNAPSHOT + 7.6.5 4.0.0 tetrad-gui diff --git a/tetrad-gui/pom.xml b/tetrad-gui/pom.xml index f324e39de3..94bfdd85df 100644 --- a/tetrad-gui/pom.xml +++ b/tetrad-gui/pom.xml @@ -6,7 +6,7 @@ io.github.cmu-phil tetrad - 7.6.5-SNAPSHOT + 7.6.5 tetrad-gui diff --git a/tetrad-lib/dependency-reduced-pom.xml b/tetrad-lib/dependency-reduced-pom.xml index 70ee5bab5a..0f07f9f36a 100644 --- a/tetrad-lib/dependency-reduced-pom.xml +++ b/tetrad-lib/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ tetrad io.github.cmu-phil - 7.6.5-SNAPSHOT + 7.6.5 4.0.0 tetrad-lib diff --git a/tetrad-lib/pom.xml b/tetrad-lib/pom.xml index 2619e66a66..c5c9765e2e 100644 --- a/tetrad-lib/pom.xml +++ b/tetrad-lib/pom.xml @@ -6,7 +6,7 @@ io.github.cmu-phil tetrad - 7.6.5-SNAPSHOT + 7.6.5 tetrad-lib diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/FciOrient.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/FciOrient.java index 23caaa5ba5..d826b4389a 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/FciOrient.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/utils/FciOrient.java @@ -246,7 +246,7 @@ public void setCompleteRuleSetUsed(boolean completeRuleSetUsed) { * Orients unshielded colliders in the graph. (FCI Step C, Zhang's step F3, rule R0.) * * @param graph The graph to orient. - * @param unshieldedTriples + * @param unshieldedTriples The set of unshielded triples oriented by R0. This set is updated with new triples. */ public void ruleR0(Graph graph, Set unshieldedTriples) { graph.reorientAllWith(Endpoint.CIRCLE); From d2abdef2970cd726824b71419c5dd2809ea0dda2 Mon Sep 17 00:00:00 2001 From: jdramsey Date: Thu, 15 Aug 2024 01:10:12 -0400 Subject: [PATCH 3/3] Upgrade Java source and target version to 21 Updated all POM files to set Java source and target versions from 17 to 21. This change applies to all modules within the project to ensure compatibility and leverage new Java 21 features. --- data-reader/pom.xml | 8 ++++---- pom.xml | 8 ++++---- tetrad-gui/dependency-reduced-pom.xml | 6 +++--- tetrad-gui/pom.xml | 6 +++--- tetrad-lib/dependency-reduced-pom.xml | 4 ++-- tetrad-lib/pom.xml | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/data-reader/pom.xml b/data-reader/pom.xml index 6abadf8c40..3f89dcf9f7 100644 --- a/data-reader/pom.xml +++ b/data-reader/pom.xml @@ -13,8 +13,8 @@ UTF-8 - 17 - 17 + 21 + 21 @@ -24,8 +24,8 @@ maven-compiler-plugin 3.11.0 - 17 - 17 + 21 + 21 diff --git a/pom.xml b/pom.xml index 455314538c..ce4766041d 100644 --- a/pom.xml +++ b/pom.xml @@ -64,8 +64,8 @@ maven-compiler-plugin 3.13.0 - 17 - 17 + 21 + 21 @@ -193,8 +193,8 @@ UTF-8 -Xdoclint:none - 17 - 17 + 21 + 21 diff --git a/tetrad-gui/dependency-reduced-pom.xml b/tetrad-gui/dependency-reduced-pom.xml index f556162c5e..ba7b3d4b2a 100644 --- a/tetrad-gui/dependency-reduced-pom.xml +++ b/tetrad-gui/dependency-reduced-pom.xml @@ -35,8 +35,8 @@ maven-compiler-plugin 3.13.0 - 17 - 17 + 21 + 21 @@ -68,7 +68,7 @@ - 17 + 21 UTF-8 diff --git a/tetrad-gui/pom.xml b/tetrad-gui/pom.xml index 94bfdd85df..7bdaa770f6 100644 --- a/tetrad-gui/pom.xml +++ b/tetrad-gui/pom.xml @@ -33,8 +33,8 @@ maven-compiler-plugin 3.13.0 - 17 - 17 + 21 + 21 @@ -186,7 +186,7 @@ UTF-8 - 17 + 21 diff --git a/tetrad-lib/dependency-reduced-pom.xml b/tetrad-lib/dependency-reduced-pom.xml index 0f07f9f36a..8bcee69567 100644 --- a/tetrad-lib/dependency-reduced-pom.xml +++ b/tetrad-lib/dependency-reduced-pom.xml @@ -20,8 +20,8 @@ maven-compiler-plugin 3.13.0 - 17 - 17 + 21 + 21 diff --git a/tetrad-lib/pom.xml b/tetrad-lib/pom.xml index c5c9765e2e..4f878a5bf5 100644 --- a/tetrad-lib/pom.xml +++ b/tetrad-lib/pom.xml @@ -18,8 +18,8 @@ maven-compiler-plugin 3.13.0 - 17 - 17 + 21 + 21