Credal InferenceΒΆ
Crema provides exact and approximate inference algorithms over credal networks.
For the exact one, create an object of class CredalVariableElimination
and
run the query. The result is an object of class VertexFactor.
.addVertex(new double[]{0.4, 0.4}, 1)
.addVertex(new double[]{0.2, 0.8}, 2)
.addVertex(new double[]{0.1, 0.9}, 2)
.get();
cnet.setFactor(X0,fa);
// set up the inference and run the queries
Approximate inference can be done by means of linear programming. For this, create
the an object of class CredalApproxLP
and then run the query. Note
that the output is an IntervalFactor
.
.constraint(new double[]{0,1}, Relationship.LEQ, 0.9, 2)
.get();
cnet.setFactor(X0,fa);
// set up the inference and run the queries
CredalApproxLP<SeparateHalfspaceFactor> inf = new CredalApproxLP<>();
IntervalFactor res1 = inf.query(cnet, ObservationBuilder.observe(X0, 0), X1);