use of edu.cmu.tetradapp.model.IndependenceFactsModel in project tetrad by cmu-phil.
the class TestIndependenceFacts method test1.
@Test
public void test1() {
IndependenceFactsModel facts = new IndependenceFactsModel();
Node x1 = new GraphNode("X1");
Node x2 = new GraphNode("X2");
Node x3 = new GraphNode("X3");
Node x4 = new GraphNode("X4");
Node x5 = new GraphNode("X5");
Node x6 = new GraphNode("X6");
facts.add(new IndependenceFact(x1, x2, x3));
facts.add(new IndependenceFact(x2, x3));
facts.add(new IndependenceFact(x2, x4, x1, x2));
facts.add(new IndependenceFact(x2, x4, x1, x3, x5));
facts.add(new IndependenceFact(x2, x4, x3));
facts.add(new IndependenceFact(x2, x4, x3, x6));
facts.remove(new IndependenceFact(x1, x2, x3));
IndependenceFacts _facts = new IndependenceFacts(facts.getFacts());
assertTrue(_facts.isIndependent(x4, x2, x1, x2));
assertTrue(_facts.isIndependent(x4, x2, x5, x3, x1));
List<Node> l = new ArrayList<>();
l.add(x1);
l.add(x2);
assertTrue(_facts.isIndependent(x4, x2, l));
}
use of edu.cmu.tetradapp.model.IndependenceFactsModel in project tetrad by cmu-phil.
the class MbSearchParamEditor method getVarsFromData.
private List<String> getVarsFromData(Object[] parentModels) {
DataModel dataModel = null;
for (Object parentModel : parentModels) {
if (parentModel instanceof DataWrapper) {
DataWrapper dataWrapper = (DataWrapper) parentModel;
dataModel = dataWrapper.getSelectedDataModel();
} else if (parentModel instanceof IndependenceFactsModel) {
dataModel = ((IndependenceFactsModel) parentModel).getFacts();
}
}
if (dataModel == null) {
return null;
} else {
return new ArrayList<>(dataModel.getVariableNames());
}
}
Aggregations