use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.
the class SkewE method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
Graph graph = algorithm.search(dataSet, parameters);
if (graph != null) {
initialGraph = graph;
} else {
throw new IllegalArgumentException("This SkewE algorithm needs both data and a graph source as inputs; it \n" + "will orient the edges in the input graph using the data");
}
List<DataSet> dataSets = new ArrayList<>();
dataSets.add(DataUtils.getContinuousDataSet(dataSet));
Lofs2 lofs = new Lofs2(initialGraph, dataSets);
lofs.setRule(Lofs2.Rule.SkewE);
return lofs.orient();
} else {
SkewE skewE = new SkewE(algorithm);
if (initialGraph != null) {
skewE.setInitialGraph(initialGraph);
}
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, skewE, parameters.getInt("bootstrapSampleSize"));
BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
switch(parameters.getInt("bootstrapEnsemble", 1)) {
case 0:
edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
break;
case 1:
edgeEnsemble = BootstrapEdgeEnsemble.Highest;
break;
case 2:
edgeEnsemble = BootstrapEdgeEnsemble.Majority;
}
search.setEdgeEnsemble(edgeEnsemble);
search.setParameters(parameters);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
}
}
use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.
the class Cpc method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
if (algorithm != null) {
// initialGraph = algorithm.search(dataSet, parameters);
}
edu.cmu.tetrad.search.PcAll search = new edu.cmu.tetrad.search.PcAll(test.getTest(dataSet, parameters), initialGraph);
search.setDepth(parameters.getInt("depth"));
search.setKnowledge(knowledge);
search.setFasRule(edu.cmu.tetrad.search.PcAll.FasRule.FAS);
search.setColliderDiscovery(PcAll.ColliderDiscovery.CONSERVATIVE);
search.setConflictRule(edu.cmu.tetrad.search.PcAll.ConflictRule.PRIORITY);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
Cpc cpc = new Cpc(test, algorithm);
// cpc.setKnowledge(knowledge);
// if (initialGraph != null) {
// cpc.setInitialGraph(initialGraph);
// }
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, cpc, parameters.getInt("bootstrapSampleSize"));
search.setKnowledge(knowledge);
BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
switch(parameters.getInt("bootstrapEnsemble", 1)) {
case 0:
edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
break;
case 1:
edgeEnsemble = BootstrapEdgeEnsemble.Highest;
break;
case 2:
edgeEnsemble = BootstrapEdgeEnsemble.Majority;
}
search.setEdgeEnsemble(edgeEnsemble);
search.setParameters(parameters);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
}
}
use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.
the class FAS method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
edu.cmu.tetrad.search.Fas search = new edu.cmu.tetrad.search.Fas(test.getTest(dataSet, parameters));
search.setDepth(parameters.getInt("depth"));
search.setKnowledge(knowledge);
return search.search();
} else {
FAS algorithm = new FAS(test);
// algorithm.setKnowledge(knowledge);
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, algorithm, parameters.getInt("bootstrapSampleSize"));
search.setKnowledge(knowledge);
BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
switch(parameters.getInt("bootstrapEnsemble", 1)) {
case 0:
edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
break;
case 1:
edgeEnsemble = BootstrapEdgeEnsemble.Highest;
break;
case 2:
edgeEnsemble = BootstrapEdgeEnsemble.Majority;
}
search.setEdgeEnsemble(edgeEnsemble);
search.setParameters(parameters);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
}
}
use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.
the class FgesD method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
if (algorithm != null) {
// initialGraph = algorithm.search(dataSet, parameters);
}
edu.cmu.tetrad.search.FgesD search;
if (dataSet instanceof ICovarianceMatrix) {
SemBicScoreDeterministic score = new SemBicScoreDeterministic((ICovarianceMatrix) dataSet);
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
score.setDeterminismThreshold(parameters.getDouble("determinismThreshold"));
search = new edu.cmu.tetrad.search.FgesD(score);
} else if (dataSet instanceof DataSet) {
SemBicScoreDeterministic score = new SemBicScoreDeterministic(new CovarianceMatrix((DataSet) dataSet));
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
score.setDeterminismThreshold(parameters.getDouble("determinismThreshold"));
search = new edu.cmu.tetrad.search.FgesD(score);
} else {
throw new IllegalArgumentException("Expecting a dataset or a covariance matrix.");
}
search.setFaithfulnessAssumed(parameters.getBoolean("faithfulnessAssumed"));
search.setKnowledge(knowledge);
search.setVerbose(parameters.getBoolean("verbose"));
search.setMaxDegree(parameters.getInt("maxDegree"));
// search.setSymmetricFirstStep(parameters.getBoolean("symmetricFirstStep"));
Object obj = parameters.get("printStedu.cmream");
if (obj instanceof PrintStream) {
search.setOut((PrintStream) obj);
}
if (initialGraph != null) {
search.setInitialGraph(initialGraph);
}
return search.search();
} else {
FgesD algorithm = new FgesD();
// algorithm.setKnowledge(knowledge);
if (initialGraph != null) {
algorithm.setInitialGraph(initialGraph);
}
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, algorithm, parameters.getInt("bootstrapSampleSize"));
search.setKnowledge(knowledge);
BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
switch(parameters.getInt("bootstrapEnsemble", 1)) {
case 0:
edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
break;
case 1:
edgeEnsemble = BootstrapEdgeEnsemble.Highest;
break;
case 2:
edgeEnsemble = BootstrapEdgeEnsemble.Majority;
}
search.setEdgeEnsemble(edgeEnsemble);
search.setParameters(parameters);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
}
}
use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.
the class FasLofsConcatenated method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (!parameters.getBoolean("bootstrapping")) {
return search(Collections.singletonList((DataModel) DataUtils.getContinuousDataSet(dataSet)), parameters);
} else {
FasLofsConcatenated algorithm = new FasLofsConcatenated(rule);
algorithm.setKnowledge(knowledge);
List<DataSet> dataSets = Collections.singletonList(DataUtils.getContinuousDataSet(dataSet));
GeneralBootstrapTest search = new GeneralBootstrapTest(dataSets, algorithm, parameters.getInt("bootstrapSampleSize"));
BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
switch(parameters.getInt("bootstrapEnsemble", 1)) {
case 0:
edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
break;
case 1:
edgeEnsemble = BootstrapEdgeEnsemble.Highest;
break;
case 2:
edgeEnsemble = BootstrapEdgeEnsemble.Majority;
}
search.setEdgeEnsemble(edgeEnsemble);
search.setParameters(parameters);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
}
}
Aggregations