Closed twugithub closed 2 years ago
Just to be sure. is the aa(2).
a type in your post here, or is it also a type in the code you tried?
The purpose of adding "aa(2)" is to just create an object called "2". But please feel free to ignore this line as it does not affect the outcomes.
In ProbLog, we only consider the relevant ground program with respect to the query. Since only b(1) can be derived from the program, all other parts are discarded.
We wanted to query all the objects related to b, and because b(2) can be derived from a(2), the result should include both b(1) and b(2). Initially we set a(2) to be false, and later we changed it to be true, but all these operations are ignored.
a(2) cannot be derived from the program currently. Consider this program instead:
aa(2).
1.0::b(X) :- a(X).
a(1).
%evidence(a(2), false).
query(b(_)).
0.5::a(2).
Hello, My name is Tong Wu. I followed the instruction at https://dtai.cs.kuleuven.be/problog/tutorial/python/01-compile-once.html for one experiment. But when I used the following code
""" from problog.program import PrologString from problog import get_evaluatable from problog.logic import Term, Constant from problog.evaluator import SemiringLogProbability
model = """ aa(2). 1.0::b(X) :- a(X). a(1). evidence(a(2), false). query(b(_)). """
Parse the Prolog string
pl_model = PrologString(model)
Compile the Prolog model into
knowledge = get_evaluatable().create_from(pl_model)
print(knowledge.evaluate())
auxi_indicator = Term('a', Constant('2'))
print(knowledge.evaluate(evidence={auxi_indicator : True})) """
to see how it works, I saw the result is always "{b(1): 1.0}". That said, the object "2" does not seem to be in the query list (of course we cannot understand whether the evidence a(2) has been switched). Could you please tell us why it is happening and is there any way to make it work? Thanks!
Best,