search = new SearchK2();
} else if( searchStr.equalsIgnoreCase("none")) {
search = new SearchNone();
}
else {
throw new BayesianError("Invalid search type: " + searchStr);
}
if( estimatorStr.equalsIgnoreCase("simple")) {
estimator = new SimpleEstimator();
} else if( estimatorStr.equalsIgnoreCase("none")) {
estimator = new EstimatorNone();
}
else {
throw new BayesianError("Invalid estimator type: " + estimatorStr);
}
if( initStr.equalsIgnoreCase("simple")) {
init = BayesianInit.InitEmpty;
} else if( initStr.equalsIgnoreCase("naive")) {
init = BayesianInit.InitNaiveBayes;
} else if( initStr.equalsIgnoreCase("none")) {
init = BayesianInit.InitNoChange;
}
else {
throw new BayesianError("Invalid init type: " + initStr);
}
return new TrainBayesian((BayesianNetwork) method, training, maxParents, init, search, estimator);
}