Skip to content

Commit

Permalink
Merge pull request #1699 from cmu-phil/joe-work-2023-10-2
Browse files Browse the repository at this point in the history
Several fixes, updates.
  • Loading branch information
jdramsey authored Oct 31, 2023
2 parents d81dd7d + 43c260d commit dccf96d
Show file tree
Hide file tree
Showing 805 changed files with 5,286 additions and 3,600 deletions.
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.5.0</version>
<version>7.5.1-SNAPSHOT</version>
</parent>
<!-- <groupId>io.github.cmu-phil</groupId>-->
<artifactId>data-reader</artifactId>
Expand Down
4 changes: 2 additions & 2 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.5.0</version>
<version>7.5.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Tetrad Project</name>
Expand Down Expand Up @@ -116,7 +116,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>3.6.0</version>
<configuration>
<javadocExecutable>/usr/bin/javadoc</javadocExecutable>
</configuration>
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.5.0</version>
<version>7.5.1-SNAPSHOT</version>
</parent>

<artifactId>tetrad-gui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.GraphNode;
import edu.cmu.tetrad.graph.GraphTransforms;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.search.utils.GraphSearchUtils;
import edu.cmu.tetrad.util.JOptionUtils;
import edu.cmu.tetrad.util.TetradSerializable;
import edu.cmu.tetradapp.workbench.DisplayEdge;
Expand All @@ -49,7 +49,7 @@ public class CPDAGDisplay extends JPanel implements GraphEditable {
private GraphWorkbench workbench;

public CPDAGDisplay(Graph graph) {
List<Graph> dags = GraphSearchUtils.generateCpdagDags(graph, false);
List<Graph> dags = GraphTransforms.generateCpdagDags(graph, false);

if (dags.size() == 0) {
JOptionPane.showMessageDialog(
Expand Down Expand Up @@ -81,7 +81,7 @@ public CPDAGDisplay(Graph graph) {
String option = (String) box.getSelectedItem();

if ("Orient --- only".equals(option)) {
List _dags = GraphSearchUtils.generateCpdagDags(graph, false);
List _dags = GraphTransforms.generateCpdagDags(graph, false);
dags.clear();
dags.addAll(_dags);
SpinnerNumberModel model1 =
Expand All @@ -97,7 +97,7 @@ public CPDAGDisplay(Graph graph) {
totalLabel.setText(" of " + dags.size());
CPDAGDisplay.this.workbench.setGraph(dags.get(0));
} else if ("Orient ---, &lt;->".equals(option)) {
List _dags = GraphSearchUtils.generateCpdagDags(graph, true);
List _dags = GraphTransforms.generateCpdagDags(graph, true);
dags.clear();
dags.addAll(_dags);
SpinnerNumberModel model1 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static String generateDescriptiveStats(DataSet dataSet, Node variable,
table.setToken(rowindex, 0, "Skewness:");
table.setToken(rowindex++, 1, nf.format(StatUtils.skewness(data)));

table.setToken(rowindex, 0, "Kurtosis:");
table.setToken(rowindex, 0, "" + "Kurtosis:");
table.setToken(rowindex++, 1, nf.format(StatUtils.kurtosis(data)));

if (continuous) {
Expand All @@ -120,7 +120,7 @@ public static String generateDescriptiveStats(DataSet dataSet, Node variable,
}

table.setToken(rowindex, 0, "Constant Columns:");
List<Node> constantColumns = DataUtils.getConstantColumns(dataSet);
List<Node> constantColumns = DataTransforms.getConstantColumns(dataSet);
table.setToken(rowindex++, 1, constantColumns.isEmpty() ? "None" : constantColumns.toString());

table.setToken(rowindex, 0, "Example Nonsingular (2 - 3 vars):");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import edu.cmu.tetrad.data.CovarianceMatrix;
import edu.cmu.tetrad.data.DataSet;
import edu.cmu.tetrad.data.DataTransforms;
import edu.cmu.tetrad.data.DataUtils;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetradapp.util.DesktopController;
Expand Down Expand Up @@ -87,13 +88,16 @@ private Box createDescriptiveStatsDialog() {

String coonstantColumnsString = "Constant Columns: ";
assert dataSet != null;
java.util.List<Node> constantColumns = DataUtils.getConstantColumns(dataSet);
java.util.List<Node> constantColumns = DataTransforms.getConstantColumns(dataSet);
coonstantColumnsString += constantColumns.isEmpty() ? "None" : constantColumns.toString();
String nonsingularString = null;

String nonsingularString = "Example Nonsingular (2 vars): ";
CovarianceMatrix covarianceMatrix = new CovarianceMatrix(dataSet);
List<Node> exampleNonsingular = DataUtils.getExampleNonsingular(covarianceMatrix, 2);
nonsingularString += exampleNonsingular == null ? "None" : exampleNonsingular.toString();
if (dataSet.isContinuous()) {
nonsingularString = "Example Nonsingular (2 vars): ";
CovarianceMatrix covarianceMatrix = new CovarianceMatrix(dataSet);
List<Node> exampleNonsingular = DataUtils.getExampleNonsingular(covarianceMatrix, 2);
nonsingularString += exampleNonsingular == null ? "None" : exampleNonsingular.toString();
}

Box box = Box.createVerticalBox();

Expand Down Expand Up @@ -128,7 +132,11 @@ private Box createDescriptiveStatsDialog() {
box.add(b1);

Box b2 = Box.createHorizontalBox();
b2.add(new JLabel(nonsingularString));
if (nonsingularString != null) {
b2.add(new JLabel(nonsingularString));
}

// b2.add(new JLabel(nonsingularString));
b2.add(Box.createHorizontalGlue());
box.add(b2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ public static Ret generateDescriptiveStats(DataSet dataSet, Node variable) {
names.add("Kurtosis");
stats.add(StatUtils.kurtosis(data));

names.add("Skewness");
stats.add(StatUtils.skewness(data));


if (continuous) {
double[] median = DescriptiveStats.median(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private JPanel createDialog(FactorAnalysis analysis) {
}
}

LayoutUtil.circleLayout(graph);
LayoutUtil.defaultLayout(graph);
LayoutUtil.fruchtermanReingoldLayout(graph);

GraphWorkbench workbench = new GraphWorkbench(graph);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void setup(String resultLabel) {
display.setEditable(false);
display.setFont(new Font("Monospaced", Font.PLAIN, 12));

LayoutUtil.circleLayout(graph);
LayoutUtil.defaultLayout(graph);
LayoutUtil.fruchtermanReingoldLayout(graph);

GraphWorkbench workbench = new GraphWorkbench(graph);
Expand Down Expand Up @@ -132,7 +132,7 @@ protected void doDefaultArrangement(Graph resultGraph) {
LayoutUtil.arrangeBySourceGraph(resultGraph,
getLatestWorkbenchGraph());
} else {
LayoutUtil.circleLayout(resultGraph);
LayoutUtil.defaultLayout(resultGraph);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @author josephramsey
*/
public class GraphAdjacencyIntersectionWrapper implements SessionModel, DoNotAddOldModel {
static final long serialVersionUID = 23L;
private static final long serialVersionUID = 23L;
private List<Graph> graphs;
private String name = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void actionPerformed(ActionEvent e) {
}

if (!allSpecified) {
LayoutUtil.circleLayout(bayesIm.getBayesPm().getDag());
LayoutUtil.defaultLayout(bayesIm.getBayesPm().getDag());
}

this.bayesImWrapper.setBayesIm(bayesIm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void actionPerformed(ActionEvent e) {
}

if (!allSpecified) {
LayoutUtil.circleLayout(bayesIm.getBayesPm().getDag());
LayoutUtil.defaultLayout(bayesIm.getBayesPm().getDag());
}

this.bayesImWrapper.setBayesIm(bayesIm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void actionPerformed(ActionEvent e) {
Preferences.userRoot().put("fileSaveLocation", file.getParent());

Graph graph = GraphSaveLoadUtils.loadGraph(file);
LayoutUtil.circleLayout(graph);
LayoutUtil.defaultLayout(graph);
this.graphEditable.setGraph(graph);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void actionPerformed(ActionEvent e) {
Preferences.userRoot().put("fileSaveLocation", file.getParent());

Graph graph = GraphSaveLoadUtils.loadGraphPcalg(file);
LayoutUtil.circleLayout(graph);
LayoutUtil.defaultLayout(graph);
this.graphEditable.setGraph(graph);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void actionPerformed(ActionEvent e) {
Preferences.userRoot().put("fileSaveLocation", file.getParent());

Graph graph = GraphSaveLoadUtils.loadGraphTxt(file);
LayoutUtil.circleLayout(graph);
LayoutUtil.defaultLayout(graph);
this.graphEditable.setGraph(graph);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public LogisticRegressionEditor(LogisticRegressionRunner regressionRunner) {
// modelParameters.setText(regRunner.getReport());
print(regressionRunner.getResult(), regressionRunner.getAlpha());
Graph outGraph = regressionRunner.getOutGraph();
LayoutUtil.circleLayout(outGraph);
LayoutUtil.defaultLayout(outGraph);
LayoutUtil.fruchtermanReingoldLayout(outGraph);
workbench.setGraph(outGraph);
TetradLogger.getInstance().log("result", this.modelParameters.getText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,14 +830,15 @@ private Box createHistogramPanel(boolean indep) {
return Box.createVerticalBox();
}


DataSet dataSet = new BoxDataSet(new VerticalDoubleDataBox(results.size(), 1),
Collections.singletonList(new ContinuousVariable("P-Value or Bump")));

for (int i = 0; i < results.size(); i++) {
dataSet.setDouble(i, 0, results.get(i).getPValue());
}

Histogram histogram = new Histogram(dataSet, "P-Value or Bump");
Histogram histogram = new Histogram(dataSet, "P-Value or Bump", false);
// histogram.setTarget("P-Value or Bump");
HistogramPanel view = new HistogramPanel(histogram, true);

Expand Down
Loading

0 comments on commit dccf96d

Please sign in to comment.