Open rcabanasdepaz opened 3 years ago
With changes at a3beffb35cca85e7cefc206fcb386015899ee3d3, now the random seed can be specified having always the same behaviour. So no this is reproducible:
double eps = 0.000000001; // eps > 0. If set to 0.0, the inference will not work.
DAGModel model = new DAGModel();
int x = model.addVariable(2);
int u = model.addVariable(3);
model.addParent(x,u);
BayesianFactor ifx = new BayesianFactor(model.getDomain(x,u));
ifx.setData(new double[] {
1., 0.,
1., 0.,
0., 1.,
});
model.setFactor(x, ifx);
IntervalFactor ifu = new IntervalFactor(model.getDomain(u), model.getDomain());
ifu.set(new double[] { 0, 0, 0.8-eps}, new double[] { 0.2, 0.2, 0.8 });
model.setFactor(u, ifu);
ApproxLP2 inference;
RandomUtil.setRandomSeed(0);
inference = new ApproxLP2();
double[] upper = inference.query(model, x).getUpper(); // works: [0.20000000099999993, 0.8]
System.out.println(Arrays.toString(upper));
RandomUtil.setRandomSeed(22);
inference = new ApproxLP2();
upper = inference.query(model, x).getUpper(); //NaN, NaN
System.out.println(Arrays.toString(upper));
Any idea? @davidhuber
I noted something similar myself; with the same linear problem but different time and space, the solver return different results. No idea how to control that. Maybe is a know issue of the org.apache.commons.math3
library?
ApproxLP occasionally produces NaN results for queries that are solvable.
Consider this code:
The out would be: