Skip to content

Commit

Permalink
Merge pull request #1531 from cmu-phil/development
Browse files Browse the repository at this point in the history
Pushing version 7.2.2 to master
  • Loading branch information
jdramsey authored Feb 21, 2023
2 parents b4b6502 + 9443f1c commit bde2c9b
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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.2.0/tetrad-gui-7.2.0-launch.jar
https://s01.oss.sonatype.org/content/repositories/releases/io/github/cmu-phil/tetrad-gui/7.2.1/tetrad-gui-7.2.1-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--

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.1</version>
<version>7.2.2</version>
</parent>
<!-- <groupId>io.github.cmu-phil</groupId>-->
<artifactId>data-reader</artifactId>
Expand Down
3 changes: 2 additions & 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.2.1</version>
<version>7.2.2</version>
<packaging>pom</packaging>

<name>Tetrad Project</name>
Expand Down Expand Up @@ -132,6 +132,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.0</version>
<dependencies>
<dependency>
<groupId>org.apache.velocity</groupId>
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.1</version>
<version>7.2.2</version>
</parent>

<artifactId>tetrad-gui</artifactId>
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.1</version>
<version>7.2.2</version>
</parent>

<artifactId>tetrad-lib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public Mgm() {

@Override
public Graph search(DataModel ds, Parameters parameters) {
if (!(ds instanceof DataSet)) {
throw new IllegalArgumentException("Expecting tabular data for MGM.");
}

DataSet _data = (DataSet) ds;

for (int j = 0; j < _data.getNumColumns(); j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import edu.cmu.tetrad.algcomparison.utils.TakesIndependenceWrapper;
import edu.cmu.tetrad.annotation.AlgType;
import edu.cmu.tetrad.annotation.Bootstrapping;
import edu.cmu.tetrad.annotation.Experimental;
import edu.cmu.tetrad.data.DataModel;
import edu.cmu.tetrad.data.DataSet;
import edu.cmu.tetrad.data.DataType;
Expand All @@ -27,6 +28,7 @@
algoType = AlgType.forbid_latent_common_causes
)
@Bootstrapping
@Experimental
public class CCD implements Algorithm, TakesIndependenceWrapper {
static final long serialVersionUID = 23L;
private IndependenceWrapper test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
command = "pag-sampling-rfci",
algoType = AlgType.allow_latent_common_causes
)
@Experimental
//@Experimental
public class PagSamplingRfci implements Algorithm, HasKnowledge {

public static final List<String> PAG_SAMPLING_RFCI_PARAMETERS = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,30 @@ public Graph search(DataModel dataSet, Parameters parameters) {

List<Node> possibleEffects = new ArrayList<>();

String targetName = parameters.getString(Params.TARGETS);
String targetNames = parameters.getString(Params.TARGETS);

if (targetName.trim().equalsIgnoreCase("")) {
if (targetNames.trim().equalsIgnoreCase("")) {
throw new IllegalStateException("Please specify target name(s).");
}

if (targetName.trim().equalsIgnoreCase("all")) {
if (targetNames.trim().equalsIgnoreCase("all")) {
for (String name : dataSet.getVariableNames()) {
possibleEffects.add(dataSet.getVariable(name));
}
} else {
String[] names = targetName.split(",");
String[] names = targetNames.split(",");

for (String name : names) {
possibleEffects.add(dataSet.getVariable(name.trim()));
}
}

List<Node> possibleCauses = new ArrayList<>(dataSet.getVariables());
// possibleCauses.removeAll(possibleEffects);

if (!(dataSet instanceof DataSet)) {
throw new IllegalArgumentException("Expecting tabular data for CStaR.");
}

LinkedList<LinkedList<Cstar.Record>> allRecords
= cStaR.getRecords((DataSet) dataSet, possibleCauses, possibleEffects, test.getTest(dataSet, parameters));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ private List<List<int[]>> filterAndOrderClusterings(List<List<int[]>> baseListOf
ClusterSignificance clusterSignificance = new ClusterSignificance(variables, covarianceMatrix);
clusterSignificance.setCheckType(checkType);
List<Integer> cluster = ClusterSignificance.getInts(currentCluster);
if (clusterSignificance.significant(cluster, alpha)) {
if (!clusterSignificance.significant(cluster, alpha)) {
continue;
}

Expand Down
16 changes: 12 additions & 4 deletions tetrad-lib/src/main/java/edu/cmu/tetrad/search/Cstar.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ public LinkedList<LinkedList<Record>> getRecords(DataSet dataSet, List<Node> pos
this.test = test;
} else if (test instanceof ChiSquare) {
this.test = test;
} else if (test instanceof IndTestScore && ((IndTestScore) test).getWrappedScore() instanceof ConditionalGaussianScore) {
this.test = test;
} else {
throw new IllegalArgumentException("Expecting Fisher Z, Chi Square, Sem BIC, or Conditional Gaussian Score.");
throw new IllegalArgumentException("Expecting Fisher Z, Chi Square, or Sem BIC.");
}

List<Map<Integer, Map<Node, Double>>> minimalEffects = new ArrayList<>();
Expand Down Expand Up @@ -244,6 +242,8 @@ public double[][] call() {
pattern = getPatternFges(sample);
} else if (Cstar.this.patternAlgorithm == PatternAlgorithm.PC_STABLE) {
pattern = getPatternPcStable(sample);
} else if (Cstar.this.patternAlgorithm == PatternAlgorithm.GRaSP) {
pattern = getPatternPcStable(sample);
} else {
throw new IllegalArgumentException("That type of of pattern algorithm is not configured: " + Cstar.this.patternAlgorithm);
}
Expand Down Expand Up @@ -600,6 +600,14 @@ private Graph getPatternPcStable(DataSet sample) {
return pc.search();
}

private Graph getPatternGRaSP(DataSet sample) {
test.setVerbose(false);
Grasp alg = new Grasp(new SemBicScore(sample));
alg.setVerbose(false);
alg.bestOrder(sample.getVariables());
return alg.getGraph(true);
}

//=============================PRIVATE==============================//

private Graph getPatternFges(DataSet sample) {
Expand Down Expand Up @@ -687,7 +695,7 @@ private List<double[][]> runCallablesDoubleArray(List<Callable<double[][]>> task
return results;
}

public enum PatternAlgorithm {FGES, PC_STABLE}
public enum PatternAlgorithm {FGES, PC_STABLE, GRaSP}

public enum SampleStyle {BOOTSTRAP, SPLIT}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ConcurrencyUtils {
public static void runCallables(List<Callable<Boolean>> tasks, boolean parallelized) {
if (tasks.isEmpty()) return;

if (parallelized) {
if (!parallelized) {
for (Callable<Boolean> task : tasks) {
try {
task.call();
Expand Down

0 comments on commit bde2c9b

Please sign in to comment.