use of edu.cmu.tetrad.search.SemBicScoreDeterministic in project tetrad by cmu-phil.
the class Pcd method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
IndTestScore test;
if (dataSet instanceof ICovarianceMatrix) {
SemBicScoreDeterministic score = new SemBicScoreDeterministic((ICovarianceMatrix) dataSet);
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
score.setDeterminismThreshold(parameters.getDouble("determinismThreshold"));
test = new IndTestScore(score);
} else if (dataSet instanceof DataSet) {
SemBicScoreDeterministic score = new SemBicScoreDeterministic(new CovarianceMatrix((DataSet) dataSet));
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
score.setDeterminismThreshold(parameters.getDouble("determinismThreshold"));
test = new IndTestScore(score);
} else {
throw new IllegalArgumentException("Expecting a dataset or a covariance matrix.");
}
edu.cmu.tetrad.search.Pcd search = new edu.cmu.tetrad.search.Pcd(test);
search.setDepth(parameters.getInt("depth"));
search.setKnowledge(knowledge);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
Pcd algorithm = new Pcd();
// 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.cmu.tetrad.search.SemBicScoreDeterministic in project tetrad by cmu-phil.
the class SemBicDTest method getTest.
@Override
public IndependenceTest getTest(DataModel dataSet, Parameters parameters) {
SemBicScoreDeterministic score = new SemBicScoreDeterministic(new CovarianceMatrix((ICovarianceMatrix) dataSet));
score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
return new IndTestScore(score, dataSet);
}
use of edu.cmu.tetrad.search.SemBicScoreDeterministic 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();
}
}
Aggregations