use of edu.cmu.tetrad.sem.DagScorer in project tetrad by cmu-phil.
the class PValueImproverEditor method setGraphWorkbench.
private void setGraphWorkbench(final GraphWorkbench graphWorkbench) {
JTabbedPane tabbedPane = new JTabbedPane();
this.graphWorkbench = graphWorkbench;
if (getOriginalSemIm() != null) {
setOriginalSemIm(new SemIm(getWrapper().getOriginalSemIm()));
}
this.newSemIm = getWrapper().getNewSemIm();
if (getNewSemIm() != null) {
SemImEditor newEditor = new SemImEditor(new SemImWrapper(getNewSemIm()));
final GraphWorkbench workbench = newEditor.getWorkbench();
workbench.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
if ("modelChanged".equals(propertyChangeEvent.getPropertyName())) {
System.out.println(propertyChangeEvent);
Graph graph = workbench.getGraph();
System.out.println(graph);
try {
new Dag(graph);
} catch (IllegalArgumentException e) {
return;
}
Scorer scorer = new DagScorer((DataSet) getWrapper().getDataModel());
scorer.score(graph);
getWrapper().setNewSemIm(scorer.getEstSem());
setGraphWorkbench(graphWorkbench);
}
}
});
tabbedPane.addTab("New Model", newEditor);
}
if (getOriginalSemIm() != null) {
SemImEditor originalEditor = new SemImEditor(new SemImWrapper(getOriginalSemIm()));
tabbedPane.addTab("Original Model", originalEditor);
}
if (graphWorkbench != null) {
tabbedPane.addTab("forbid_latent_common_causes", graphWorkbench);
}
panel.removeAll();
panel.add(tabbedPane, BorderLayout.CENTER);
panel.revalidate();
panel.repaint();
firePropertyChange("modelChanged", null, null);
}
Aggregations