use of edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class Fask method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
edu.cmu.tetrad.search.Fask search = new edu.cmu.tetrad.search.Fask((DataSet) dataSet, score.getScore(dataSet, parameters));
search.setDepth(parameters.getInt("depth"));
search.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
search.setExtraEdgeThreshold(parameters.getDouble("extraEdgeThreshold"));
search.setUseFasAdjacencies(parameters.getBoolean("useFasAdjacencies"));
search.setUseSkewAdjacencies(parameters.getBoolean("useCorrDiffAdjacencies"));
search.setAlpha(parameters.getDouble("twoCycleAlpha"));
search.setDelta(parameters.getDouble("faskDelta"));
// search.setPercentBootstrapForLinearityTest(parameters.getDouble("percentBootstrapForLinearityTest"));
// search.setNumBootstrapForLinearityTest(parameters.getInt("numBootstrapForLinearityTest"));
// search.setCutoffForLinearityTest(parameters.getDouble("cutoffForLinearityTest"));
search.setKnowledge(knowledge);
return getGraph(search);
} else {
Fask fask = new Fask(score);
fask.setKnowledge(knowledge);
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, fask, 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.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class FgesConcatenated method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (!parameters.getBoolean("bootstrapping")) {
return search(Collections.singletonList((DataModel) DataUtils.getContinuousDataSet(dataSet)), parameters);
} else {
FgesConcatenated fgesConcatenated = new FgesConcatenated(score, initialGraph);
fgesConcatenated.setCompareToTrue(compareToTrue);
fgesConcatenated.setKnowledge(knowledge);
List<DataSet> dataSets = Collections.singletonList(DataUtils.getContinuousDataSet(dataSet));
GeneralBootstrapTest search = new GeneralBootstrapTest(dataSets, fgesConcatenated, 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.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class ImagesSemBic method search.
@Override
public Graph search(List<DataModel> dataSets, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
final SemBicScoreImages score = new SemBicScoreImages(dataSets);
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
edu.cmu.tetrad.search.Fges search = new edu.cmu.tetrad.search.Fges(score);
search.setKnowledge(knowledge);
return search.search();
} else {
ImagesSemBic imagesSemBic = new ImagesSemBic();
// imagesSemBic.setKnowledge(knowledge);
List<DataSet> datasets = new ArrayList<>();
for (DataModel dataModel : dataSets) {
datasets.add((DataSet) dataModel);
}
GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, imagesSemBic, 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.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class R1 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 R1 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.R1);
return lofs.orient();
} else {
R1 r1 = new R1(algorithm);
if (initialGraph != null) {
r1.setInitialGraph(initialGraph);
}
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, r1, 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.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class RSkew 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 RSkew 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.RSkew);
return lofs.orient();
} else {
RSkew rSkew = new RSkew(algorithm);
if (initialGraph != null) {
rSkew.setInitialGraph(initialGraph);
}
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, rSkew, 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