use of edu.cmu.tetrad.bayes.MlBayesEstimator in project tetrad by cmu-phil.
the class BayesEstimatorWrapper method estimate.
private void estimate(DataSet dataSet, BayesPm bayesPm) {
Graph graph = bayesPm.getDag();
for (Object o : graph.getNodes()) {
Node node = (Node) o;
if (node.getNodeType() == NodeType.LATENT) {
throw new IllegalArgumentException("Estimation of Bayes IM's " + "with latents is not supported.");
}
}
if (DataUtils.containsMissingValue(dataSet)) {
throw new IllegalArgumentException("Please remove or impute missing values.");
}
try {
MlBayesEstimator estimator = new MlBayesEstimator();
this.bayesIm = estimator.estimate(bayesPm, dataSet);
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
throw new RuntimeException("Value assignments between Bayes PM " + "and discrete data set do not match.");
}
}
Aggregations