Does anyone know the "proper" procedure to learn a Bayesian Network from data using the WEKA API? I can't find good instructions in the WEKA documentation.
Based on the documentation and what each function is "supposed" to do, I thought this would work:
Instances ins = DataSource.read( filename );
ins.setClassIndex(0);
K2 learner = new K2();
MultiNomialBMAEstimator estimator = new MultiNomialBMAEstimator();
estimator.setUseK2Prior(true);
EditableBayesNet bn = new EditableBayesNet( ins );
bn.initStructure();
learner.buildStructure(bn, ins);
estimator.estimateCPTs(bn);
But it doesn't. I've tried this and other variations and I keep getting ArrayIndexOutOfBoundsException
or NullPointerException
somewhere inside WEKA code, so what am I missing?