Skip to content

Commit

Permalink
Merge pull request #1528 from cmu-phil/development
Browse files Browse the repository at this point in the history
7.2.1 code
  • Loading branch information
jdramsey authored Feb 19, 2023
2 parents 3caee6e + 265e0be commit b4b6502
Show file tree
Hide file tree
Showing 39 changed files with 220 additions and 328 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ https://s01.oss.sonatype.org/content/repositories/releases/io/github/cmu-phil/

The jar to launch the Tetrad GUI is here (please download this one and delete any old ones):

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

The application will work on all major platforms once a recent version of the Java JRE is installed. (Corretto 18 is fine, for instance.) You may be able to launch it by double clicking the jar file name, though on a Mac, this presents some security challenges--

https://github.com/cmu-phil/tetrad/wiki/Dealing-with-Tetrad-on-a-Mac--security-issues
https://github.com/cmu-phil/tetrad/wiki/Dealing-with-Tetrad-on-a-Mac:--Security-Issues

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: 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.2.0</version>
<version>7.2.1</version>
</parent>
<!-- <groupId>io.github.cmu-phil</groupId>-->
<artifactId>data-reader</artifactId>
Expand Down
43 changes: 39 additions & 4 deletions docs/manual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2889,7 +2889,7 @@ <h3>The IMaGES Algorithm</h3>

<h4>Description</h4>

<div id="imgs_cont">
<div id="images">

<p>Adjusts the selected score for FGES so
allow for multiple datasets as input. The linear, Gaussian BIC scores
Expand Down Expand Up @@ -3118,7 +3118,7 @@ <h3>The GRaSP-FCI Algorithm</h3>

<h4>Description</h4>

<div id="graspfci">
<div id="grasp-fci">

<p>GRaSP-FCI is wrapper around the GRaSP algorithm that replaces
the FGES step in GFCI with the more accurate GRaSP algrorithm, which
Expand Down Expand Up @@ -3829,7 +3829,7 @@ <h4>Description</h4>

<h4>Input Assumptions</h4>

<p>Continuous, linear data in which all of the variables are
<p>Continuous, linear data in which all the variables are
skewed.</p>

<h4>Output Format</h4>
Expand Down Expand Up @@ -3946,6 +3946,40 @@ <h4>Parameters</h4>

<p><a href="#maxit">alpha</a>, <a href="#depth">depth</a></p>

<h3>The CStaR Algorithm</h3>

<h4>Description</h4>

<div id="cstar">

<p>The CStaR algorithm (Causal Stability Ranking, Stekhoven,
D. J., Moraes, I., Sveinbjörnsson, G., Hennig, L.,
Maathuis, M. H., & Bühlmann, P. 2012. Causal stability
ranking. Bioinformatics, 28(21), 2819-2823) calculates
lower bounds on estimated parameters for the causally
sufficient case. It first runs a CPDAG algorithm and then
for X->Y locally about Y finds all possible orientation of
the edges in the CPDAG and does an estimation for each of
these and finds their lower bound. In the interface,
all nodes that are found to have significant impace on
a given target nodes are marked as into that target node.
However, the more useful thing is to look at the CStaR
table produced by the procedure. To see this table, either
run CStaR on a dataset, specifying a target node, and the
table will be printed out, or run Tetrad using java -jar
and look at the console output, or if these methods are
not available, turn on logging in the interface before
running the methods, and the table will be printed out.
The table is to interpreted as in the Steckhoven et al.
paper cited above (see), and is in the same format.
</p>

</div>

<h4>Input Assumptions</h4>

<p>Same as for PC.</p>


<h2>Statistical Tests</h2>

Expand Down Expand Up @@ -8483,9 +8517,10 @@ <h3 class="parameter_description" id="checkType">checkType</h3>
<li>Short Description: <span
id="checkType_short_desc">
Model significance check type: 1 = Significance, 2 = Clique, 3 = None
</span></li>
<li>Long Description: <span id="checkType_long_desc">
Model significance check type: 1 = Significance, 2 = Clique, 3 = None
</span></li>
</span></li>
<li>Default Value: <span
id="checkType_default_value">1</span></li>
<li>Lower Bound: <span
Expand Down
75 changes: 59 additions & 16 deletions 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.2.0</version>
<version>7.2.1</version>
<packaging>pom</packaging>

<name>Tetrad Project</name>
Expand Down Expand Up @@ -80,27 +80,39 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
<configuration>
<port>9000</port>
<tempWebappDirectory>${basedir}/target/site/tempdir</tempWebappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<id>copy-dist-resources</id>
<phase>validate</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dist</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/dist</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -117,17 +129,48 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
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.2.0</version>
<version>7.2.1</version>
</parent>

<artifactId>tetrad-gui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public RandomMimParamsEditor(Parameters parameters) {
b1.add(b18);

Box b19 = Box.createHorizontalBox();
b19.add(new JLabel("Measured &lt;-> Measured"));
b19.add(new JLabel("Measured <-> Measured"));
b19.add(Box.createHorizontalGlue());
b19.add(numMeasuredMeasuredImpureAssociations);
b1.add(b19);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ public void execute() {

Algorithm algo = getAlgorithm();

if (algo instanceof HasKnowledge) {
((HasKnowledge) algo).setKnowledge(this.knowledge.copy());
if (this.knowledge != null && !knowledge.isEmpty()) {
if (algo instanceof HasKnowledge) {
((HasKnowledge) algo).setKnowledge(this.knowledge.copy());
} else {
throw new IllegalArgumentException("Knowledge has been supplied, but this algorithm does not use knowledge.");
}
}

if (getDataModelList().size() == 0 && getSourceGraph() != null) {
Expand Down Expand Up @@ -286,10 +290,8 @@ public void execute() {
if (getAlgorithm() instanceof MultiDataSetAlgorithm) {
for (int k = 0; k < this.parameters.getInt("numRuns"); k++) {
Knowledge knowledge1 = getDataModelList().get(0).getKnowledge();
List<DataSet> dataSets = getDataModelList().stream()
.map(e -> (DataSet) e)
.collect(Collectors.toCollection(ArrayList::new));
for (DataSet dataSet : dataSets) dataSet.setKnowledge(knowledge1);
List<DataModel> dataSets = new ArrayList<>(getDataModelList());
for (DataModel dataSet : dataSets) dataSet.setKnowledge(knowledge1);
int randomSelectionSize = this.parameters.getInt("randomSelectionSize");
if (randomSelectionSize == 0) {
randomSelectionSize = dataSets.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public SemEstimatorWrapper(DataModel dataModel, SemPm semPm, Parameters params)
ICovarianceMatrix covMatrix = new CovarianceMatrix((ICovarianceMatrix) dataModel);
SemEstimator estimator = new SemEstimator(covMatrix, semPm, getOptimizer());
estimator.setNumRestarts(getParams().getInt("numRestarts", 1));
estimator.setScoreType((ScoreType) getParams().get("scoreType", ScoreType.SemBic));
estimator.setScoreType((ScoreType) getParams().get("scoreType", ScoreType.Fml));
estimator.estimate();
if (!degreesOfFreedomCheck(semPm)) {
throw new IllegalArgumentException("Cannot proceed.");
Expand Down
2 changes: 1 addition & 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.2.0</version>
<version>7.2.1</version>
</parent>

<artifactId>tetrad-lib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
*/
package edu.cmu.tetrad.algcomparison.algorithm;

import edu.cmu.tetrad.algcomparison.algorithm.oracle.cpdag.SingleGraphAlg;
import edu.cmu.tetrad.algcomparison.independence.IndependenceWrapper;
import edu.cmu.tetrad.algcomparison.score.ScoreWrapper;
import edu.cmu.tetrad.algcomparison.utils.TakesExternalGraph;
import edu.cmu.tetrad.algcomparison.utils.TakesIndependenceWrapper;
import edu.cmu.tetrad.algcomparison.utils.UsesScoreWrapper;
import edu.cmu.tetrad.annotation.AlgorithmAnnotations;
import edu.cmu.tetrad.graph.Graph;
import org.apache.commons.math3.analysis.function.Sin;

/**
* Aug 30, 2017 3:14:40 PM
Expand Down Expand Up @@ -68,7 +70,7 @@ public static Algorithm create(Class<? extends Algorithm> algoClass, Independenc
throws IllegalAccessException, InstantiationException {
Algorithm algorithm = AlgorithmFactory.create(algoClass, test, score);
if (externalGraph != null && algorithm instanceof TakesExternalGraph) {
((TakesExternalGraph) algorithm).setExternalGraph(externalGraph);
((TakesExternalGraph) algorithm).setExternalGraph(new SingleGraphAlg(externalGraph));
}

return algorithm;
Expand All @@ -90,7 +92,7 @@ public static Algorithm create(Class<? extends Algorithm> algoClass, Class<? ext
throws IllegalAccessException, InstantiationException {
Algorithm algorithm = AlgorithmFactory.create(algoClass, indTestClass, scoreClass);
if (externalGraph != null && algorithm instanceof TakesExternalGraph) {
((TakesExternalGraph) algorithm).setExternalGraph(externalGraph);
((TakesExternalGraph) algorithm).setExternalGraph(new SingleGraphAlg(externalGraph));
}

return algorithm;
Expand Down
Loading

0 comments on commit b4b6502

Please sign in to comment.