This works for me. I tried with the following dataset:
@relation test @attribute x {0,1} @attribute y {0,1,2} @attribute z {0,1} @data 0,1,0 1,0,1 1,1,1 1,2,1 0,0,0
Let me mention that exceptions are expected when your target attribute is not nominal (e.g. numeric). Bayesian networks work best when all your attributes are nominal. If you change the target attribute to numeric, you will get a NullPointerException or ArrayIndexOutOfBoundsException . In particular, this exception is thrown on the line:
EditableBayesNet bn = new EditableBayesNet(ins);
You must discretize your target class first.
source share