Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging changes for 7.6.1. #1709

Merged
merged 29 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c55ca9b
Update INSTALL_APPLICATION.md
jdramsey Oct 31, 2023
546a17c
Update README.md
jdramsey Oct 31, 2023
707851b
Added shading to the Tetrad lib jar.
jdramsey Nov 7, 2023
71dd202
fixed error that was always forbidding all edges within each tier
bja43 Nov 8, 2023
bd6dbc7
Merge pull request #1705 from cmu-phil/knowledge_fix
jdramsey Nov 8, 2023
12e2676
Added shading to the Tetrad lib jar.
jdramsey Nov 8, 2023
2270906
Fixed the circle layout in the interface.
jdramsey Nov 8, 2023
e0a4e66
Merge pull request #1707 from cmu-phil/fix-circle-layout
bja43 Nov 8, 2023
b519b73
Updated version to 7.6.1-SNAPSHOT
jdramsey Nov 8, 2023
de57757
Fixed test.
jdramsey Nov 8, 2023
063d8e1
Added the demixer code.
jdramsey Nov 9, 2023
14e2dd1
Added the demixer code.
jdramsey Nov 9, 2023
f3e4fc2
Adding the ordered local check to the Markov Checker.
jdramsey Nov 9, 2023
e67267c
Adding the ordered local check to the Markov Checker.
jdramsey Nov 9, 2023
f414cbb
Added shading to the lib jar.
jdramsey Nov 9, 2023
fc2bd96
Stamping DirectLiNGAM and ICALiNGAM results with BIC.
jdramsey Nov 13, 2023
2290324
Testing a solution to a boss hanging problem.
jdramsey Nov 13, 2023
6135983
Fixed hanging problem with GRaSP, BOSS, etc.
jdramsey Nov 13, 2023
f87bf63
Updated version to 7.6.1-SNAPSHOT
jdramsey Nov 13, 2023
da1d47a
Updated version to 7.6.1-SNAPSHOT
jdramsey Nov 13, 2023
170536f
Moved ConidtioningSetType to upper level because JPype was unable to …
jdramsey Nov 13, 2023
cdba262
Reapplying the forbidden edges knowledge fix.
jdramsey Nov 14, 2023
af0ecad
Reapplying the forbidden edges knowledge fix.
jdramsey Nov 14, 2023
1d19e8b
Re-fixing this FCI test.
jdramsey Nov 14, 2023
0c11e1b
Merge branch 'development' into joe-work-11-5-2023
jdramsey Nov 15, 2023
2ec8349
Merge pull request #1708 from cmu-phil/joe-work-11-5-2023
jdramsey Nov 15, 2023
ae93285
Exposed some methods for allow Markov Checker independencies to be pr…
jdramsey Nov 15, 2023
3a128e0
Updating version to 7.6.1.
jdramsey Nov 15, 2023
2484a27
Merge branch 'master' into development
jdramsey Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion INSTALL_APPLICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Please use a recent Java JDK. See [Setting up Java for Tetrad](https://github.co

To download the Tetrad jar, please click the following link (which will always be updated to the latest version):

https://s01.oss.sonatype.org/content/repositories/releases/io/github/cmu-phil/tetrad-gui/7.5.0/tetrad-gui-7.5.0-launch.jar
https://s01.oss.sonatype.org/content/repositories/releases/io/github/cmu-phil/tetrad-gui/7.6.0/tetrad-gui-7.6.0-launch.jar

You may be able to launch this jar by double-clicking the jar file name. However, on a Mac, this presents some security challenges. On all platforms, the jar may be launched at the command line (with a specification of the amount of RAM you will allow it to use) using this command:

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ See out insructions for [Installing the Tetrad Application](https://github.com/c

We have a project, [py-tetrad](https://github.com/cmu-phil/py-tetrad), that allows you to incorporate arbitrary Tetrad code into a Python workflow. It's new, and the installation is still nonstandard, but it had a good response. This requires Python 3.5+. and Java JDK 9+.

Please see our [description](https://sites.google.com/view/tetradcausal/tetrad-in-python

## Tetrad in R

We also have a project, [rpy-tetrad](https://github.com/cmu-phil/py-tetrad/tree/main/pytetrad/R), that allows you to incorporate _some_ Tetrad functionality in R. It's also new, and the installation for it is also still nonstandard, but has gotten good feedback. This requires Python 3.5+ and Java JDK 9+.
Expand Down
2 changes: 1 addition & 1 deletion data-reader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.github.cmu-phil</groupId>
<artifactId>tetrad</artifactId>
<version>7.6.0</version>
<version>7.6.1</version>
</parent>
<!-- <groupId>io.github.cmu-phil</groupId>-->
<artifactId>data-reader</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.cmu-phil</groupId>
<artifactId>tetrad</artifactId>
<version>7.6.0</version>
<version>7.6.1</version>
<packaging>pom</packaging>

<name>Tetrad Project</name>
Expand Down
2 changes: 1 addition & 1 deletion tetrad-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.cmu-phil</groupId>
<artifactId>tetrad</artifactId>
<version>7.6.0</version>
<version>7.6.1</version>
</parent>

<artifactId>tetrad-gui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import edu.cmu.tetrad.graph.GraphUtils;
import edu.cmu.tetrad.graph.IndependenceFact;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.search.ConditioningSetType;
import edu.cmu.tetrad.search.IndependenceTest;
import edu.cmu.tetrad.search.MarkovCheck;
import edu.cmu.tetrad.search.test.IndependenceResult;
import edu.cmu.tetrad.search.test.MsepTest;
import edu.cmu.tetrad.util.NumberFormatUtil;
Expand Down Expand Up @@ -99,20 +99,24 @@ public MarkovCheckEditor(MarkovCheckIndTestModel model) {
throw new NullPointerException("Expecting a model");
}

conditioningSetTypeJComboBox.addItem("Parents(X)");
conditioningSetTypeJComboBox.addItem("Parents(X) (Local Markov)");
conditioningSetTypeJComboBox.addItem("Parents(X) for a Valid Order (Ordered Local Markov)");
conditioningSetTypeJComboBox.addItem("MarkovBlanket(X)");
conditioningSetTypeJComboBox.addItem("All Subsets");
conditioningSetTypeJComboBox.addItem("All Subsets (Global Markov)");

conditioningSetTypeJComboBox.addActionListener(e -> {
switch ((String) Objects.requireNonNull(conditioningSetTypeJComboBox.getSelectedItem())) {
case "Parents(X)":
model.getMarkovCheck().setSetType(MarkovCheck.ConditioningSetType.PARENTS);
case "Parents(X) (Local Markov)":
model.getMarkovCheck().setSetType(ConditioningSetType.LOCAL_MARKOV);
break;
case "Parents(X) for a Valid Order (Ordered Local Markov)":
model.getMarkovCheck().setSetType(ConditioningSetType.ORDERED_LOCAL_MARKOV);
break;
case "MarkovBlanket(X)":
model.getMarkovCheck().setSetType(MarkovCheck.ConditioningSetType.MARKOV_BLANKET);
model.getMarkovCheck().setSetType(ConditioningSetType.MARKOV_BLANKET);
break;
case "All Subsets":
model.getMarkovCheck().setSetType(MarkovCheck.ConditioningSetType.ALL_SUBSETS);
case "All Subsets (Global Markov)":
model.getMarkovCheck().setSetType(ConditioningSetType.GLOBAL_MARKOV);
break;
default:
throw new IllegalArgumentException("Unknown conditioning set type: " +
Expand All @@ -121,7 +125,7 @@ public MarkovCheckEditor(MarkovCheckIndTestModel model) {

class MyWatchedProcess extends WatchedProcess {
public void watch() {
if (model.getMarkovCheck().getSetType() == MarkovCheck.ConditioningSetType.ALL_SUBSETS && model.getVars().size() > 12) {
if (model.getMarkovCheck().getSetType() == ConditioningSetType.GLOBAL_MARKOV && model.getVars().size() > 12) {
int ret = JOptionPane.showOptionDialog(MarkovCheckEditor.this,
"The all subsets option is exponential and can become extremely slow beyond 12" +
"\nvariables. You may possibly be required to force quit Tetrad. Continue?", "Warning",
Expand Down Expand Up @@ -277,7 +281,7 @@ public void watch() {

JTabbedPane pane = new JTabbedPane();
pane.addTab("Check Markov", indep);
pane.addTab("Check Faithfulness", dep);
pane.addTab("Check Dependent Distribution", dep);
pane.addTab("Help", scroll);
box.add(pane);

Expand Down Expand Up @@ -310,13 +314,13 @@ public void watch() {

@NotNull
private static String getHelpMessage() {
return "This tool lets you plot statistics for independence tests of a pair of variables given some conditioning calculated for one of those variables, for a given graph and dataset. Two tables are made, one in which the independence facts predicted by the graph using these conditioning sets are tested in the data and the other in which the graph's predicted dependence facts are tested. The first of these sets is a test for \"Markov\" for the relevant conditioning sets; the is a test for \"Faithfulness.”\n" +
return "This tool lets you plot statistics for independence tests of a pair of variables given some conditioning calculated for one of those variables, for a given graph and dataset. Two tables are made, one in which the independence facts predicted by the graph using these conditioning sets are tested in the data and the other in which the graph's predicted dependence facts are tested. The first of these sets is a check for \"Markov\" (a check for implied independence facts) for the chosen conditioning sets; the is a check of the \"Dependent Distribution.\" (a check of implied dependence facts)”\n" +
"\n" +
"Each table gives columns for the independence fact being checked, its test result, and its statistic. This statistic is either a p-value, ranging from 0 to 1, where p-values above the alpha level of the test are judged as independent, or a score bump, where this bump is negative for independent judgments and positive for dependent judgments.\n" +
"\n" +
"If the independence test yields a p-value, as for instance, for the Fisher Z test (for the linear, Gaussian case) or else the Chi-Square test (for the multinomial case), then under the null hypothesis of independence and for a consistent test, these p-values should be distributed as Uniform(0, 1). That is, it should be just as likely to see p-values in any range of equal width. If the test is inconsistent or the graph is incorrect (i.e., the parents of some or all of the nodes in the graph are incorrect), then this distribution of p-values will not be Uniform. To visualize this, we display the histogram of the p-values with equally sized bins; the bars in this histogram, for this case, should ideally all be of equal height.\n" +
"\n" +
"If the first bar in this histogram is especially high (for the p-value case), that means that many tests are being judged as dependent. For checking Faithfulness, one hopes that this list is non-empty, then this first bar will be especially high, since high p-values are for examples where the graph is unfaithful to the distribution. These are likely for for cases where paths in the graph cancel unfaithfully. But for checking Markov, one hopes that this first bar will be the same height as all of the other bars.\n" +
"If the first bar in this histogram is especially high (for the p-value case), that means that many tests are being judged as dependent. For checking the dependent distribution, one hopes that this list is non-empty, in which case this first bar will be especially high, since high p-values are for examples where the graph is unfaithful to the distribution. These are likely for for cases where paths in the graph cancel unfaithfully. But for checking Markov, one hopes that this first bar will be the same height as all of the other bars.\n" +
"\n" +
"To make it especially clear, we give two statistics in the interface. The first is the percentage of p-values judged dependent on the test. If an alpha level is used in the test, this number should be very close to the alpha level for the Local Markov check since the distribution of p-values under this condition is Uniform. For the second, we test the Uniformity of the p-values using a Kolmogorov-Smirnov test. The p-value returned by this test should be greater than the user’s preferred alpha level if the distribution of p-values is Uniform and less then this alpha level if the distribution of p-values is non-Uniform.\n" +
"\n" +
Expand Down Expand Up @@ -492,6 +496,12 @@ public void mouseClicked(MouseEvent e) {
// scroll.setPreferredSize(new Dimension(400, 400));
b1.add(scroll);

Box b1a = Box.createHorizontalBox();
JLabel label = new JLabel("Table contents can be selected and copied in to, e.g., Excel.");
b1a.add(label);
b1a.add(Box.createHorizontalGlue());
b1.add(b1a);

Box b4 = Box.createHorizontalBox();
b4.add(Box.createGlue());
b4.add(Box.createHorizontalStrut(10));
Expand Down Expand Up @@ -678,6 +688,12 @@ public void mouseClicked(MouseEvent e) {
// scroll.setPreferredSize(new Dimension(400, 400));
b1.add(scroll);

Box b1a = Box.createHorizontalBox();
JLabel label = new JLabel("Table contents can be selected and copied in to, e.g., Excel.");
b1a.add(label);
b1a.add(Box.createHorizontalGlue());
b1.add(b1a);

Box b4 = Box.createHorizontalBox();
b4.add(Box.createGlue());
b4.add(Box.createHorizontalStrut(10));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import edu.cmu.tetrad.data.DataModel;
import edu.cmu.tetrad.data.Knowledge;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.search.ConditioningSetType;
import edu.cmu.tetrad.search.IndependenceTest;
import edu.cmu.tetrad.search.MarkovCheck;
import edu.cmu.tetrad.search.test.IndependenceResult;
Expand Down Expand Up @@ -64,7 +65,7 @@ public static Knowledge serializableInstance() {
}

public void setIndependenceTest(IndependenceTest test) {
this.markovCheck = new MarkovCheck(this.graph, test, this.markovCheck == null ? MarkovCheck.ConditioningSetType.PARENTS : this.markovCheck.getSetType());
this.markovCheck = new MarkovCheck(this.graph, test, this.markovCheck == null ? ConditioningSetType.LOCAL_MARKOV : this.markovCheck.getSetType());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public static void circleLayout(LayoutEditable layoutEditable) {

int m = FastMath.min(r.width, r.height) / 2;

LayoutUtil.defaultLayout(graph);
LayoutUtil.circleLayout(graph);
layoutEditable.layoutByGraph(graph);
LayoutUtils.layout = Layout.circle;
}
Expand Down
62 changes: 62 additions & 0 deletions tetrad-lib/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>tetrad</artifactId>
<groupId>io.github.cmu-phil</groupId>
<version>7.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tetrad-lib</artifactId>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

31 changes: 30 additions & 1 deletion tetrad-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.cmu-phil</groupId>
<artifactId>tetrad</artifactId>
<version>7.6.0</version>
<version>7.6.1</version>
</parent>

<artifactId>tetrad-lib</artifactId>
Expand All @@ -22,6 +22,35 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<!-- <Main-Class>edu.cmu.tetradapp.Tetrad</Main-Class>-->
<Permissions>all-permissions</Permissions>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName> <!-- Any name that makes sense -->
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import edu.cmu.tetrad.graph.EdgeListGraph;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.search.score.Score;
import edu.cmu.tetrad.search.utils.LogUtilsSearch;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.Params;
import edu.cmu.tetrad.util.TetradLogger;
Expand Down Expand Up @@ -56,6 +57,7 @@ public Graph search(DataModel dataSet, Parameters parameters) {
Graph graph = search.search();
TetradLogger.getInstance().forceLogMessage(graph.toString());

LogUtilsSearch.stampWithBic(graph, dataSet);
return graph;
} else {
DirectLingam algorithm = new DirectLingam();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.cmu.tetrad.graph.EdgeListGraph;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.search.IcaLingD;
import edu.cmu.tetrad.search.utils.LogUtilsSearch;
import edu.cmu.tetrad.util.Matrix;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.Params;
Expand Down Expand Up @@ -56,6 +57,7 @@ public Graph search(DataModel dataSet, Parameters parameters) {
TetradLogger.getInstance().forceLogMessage(bHat.toString());
TetradLogger.getInstance().forceLogMessage(graph.toString());

LogUtilsSearch.stampWithBic(graph, dataSet);
return graph;
} else {
IcaLingam algorithm = new IcaLingam();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.search.PermutationSearch;
import edu.cmu.tetrad.search.score.Score;
import edu.cmu.tetrad.search.utils.LogUtilsSearch;
import edu.cmu.tetrad.search.utils.TsUtils;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.Params;
Expand Down Expand Up @@ -51,7 +52,6 @@ public Boss(ScoreWrapper score) {
this.score = score;
}


@Override
public Graph search(DataModel dataModel, Parameters parameters) {
if (parameters.getInt(Params.NUMBER_RESAMPLING) < 1) {
Expand All @@ -75,8 +75,9 @@ public Graph search(DataModel dataModel, Parameters parameters) {
boss.setVerbose(parameters.getBoolean(Params.VERBOSE));
PermutationSearch permutationSearch = new PermutationSearch(boss);
permutationSearch.setKnowledge(this.knowledge);

return permutationSearch.search();
Graph graph = permutationSearch.search();
LogUtilsSearch.stampWithScores(graph, dataModel, score);
return graph;
} else {
Boss algorithm = new Boss(this.score);

Expand Down
Loading