use of edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class ImagesPcStableMax method search.
@Override
public Graph search(List<DataModel> dataModels, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
List<DataSet> dataSets = new ArrayList<>();
for (DataModel dataModel : dataModels) {
dataSets.add((DataSet) dataModel);
}
SemBicScoreImages3 score = new SemBicScoreImages3(dataSets);
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
IndependenceTest test = new IndTestScore(score);
PcStableMax search = new PcStableMax(test);
search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
search.setKnowledge(knowledge);
search.setDepth(parameters.getInt("depth"));
return search.search();
} else {
ImagesPcStableMax imagesPcStableMax = new ImagesPcStableMax();
// imagesPcStableMax.setKnowledge(knowledge);
List<DataSet> datasets = new ArrayList<>();
for (DataModel dataModel : dataModels) {
datasets.add((DataSet) dataModel);
}
GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, imagesPcStableMax, 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 PcStableMaxConcatenated method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (!parameters.getBoolean("bootstrapping")) {
return search(Collections.singletonList((DataModel) DataUtils.getContinuousDataSet(dataSet)), parameters);
} else {
PcStableMaxConcatenated pcStableMaxConcatenated = new PcStableMaxConcatenated(test, compareToTrue);
pcStableMaxConcatenated.setKnowledge(knowledge);
List<DataSet> dataSets = Collections.singletonList(DataUtils.getContinuousDataSet(dataSet));
GeneralBootstrapTest search = new GeneralBootstrapTest(dataSets, pcStableMaxConcatenated, 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 PcStableMaxConcatenated method search.
@Override
public Graph search(List<DataModel> dataModels, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
List<DataSet> dataSets = new ArrayList<>();
for (DataModel dataModel : dataModels) {
dataSets.add((DataSet) dataModel);
}
DataSet dataSet = DataUtils.concatenate(dataSets);
PcStableMax search = new PcStableMax(test.getTest(dataSet, parameters));
search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
search.setKnowledge(knowledge);
search.setDepth(parameters.getInt("depth"));
return search.search();
} else {
PcStableMaxConcatenated pcStableMaxConcatenated = new PcStableMaxConcatenated(test, compareToTrue);
// pcStableMaxConcatenated.setKnowledge(knowledge);
List<DataSet> datasets = new ArrayList<>();
for (DataModel dataModel : dataModels) {
datasets.add((DataSet) dataModel);
}
GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, pcStableMaxConcatenated, 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 PcFges method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
DataSet _dataSet = (DataSet) dataSet;
ICovarianceMatrix cov = new CovarianceMatrix(_dataSet);
// parameters.getDouble("alpha")));
edu.cmu.tetrad.search.FasStable fas = new edu.cmu.tetrad.search.FasStable(new IndTestFisherZ(cov, 0.001));
Graph bound = fas.search();
edu.cmu.tetrad.search.Fges search = new edu.cmu.tetrad.search.Fges(score.getScore(cov, parameters));
search.setVerbose(parameters.getBoolean("verbose"));
search.setFaithfulnessAssumed(parameters.getBoolean("faithfulnessAssumed"));
search.setKnowledge(knowledge);
search.setMaxDegree(parameters.getInt("maxDegree"));
search.setSymmetricFirstStep(parameters.getBoolean("symmetricFirstStep"));
System.out.println("Bound graph done");
Object obj = parameters.get("printStream");
if (obj instanceof PrintStream) {
search.setOut((PrintStream) obj);
}
search.setBoundGraph(bound);
return search.search();
} else {
PcFges algorithm = new PcFges(score, compareToTrue);
// 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.BootstrapEdgeEnsemble in project tetrad by cmu-phil.
the class PcStableMax 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_STABLE);
search.setColliderDiscovery(PcAll.ColliderDiscovery.MAX_P);
search.setConflictRule(edu.cmu.tetrad.search.PcAll.ConflictRule.PRIORITY);
search.setVerbose(parameters.getBoolean("verbose"));
search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
return search.search();
} else {
PcStableMax pcStableMax = new PcStableMax(test, compareToTrue);
// pcStableMax.setKnowledge(knowledge);
if (initialGraph != null) {
pcStableMax.setInitialGraph(initialGraph);
}
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, pcStableMax, 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();
}
}
Aggregations