raki123 / counterfactuals

A solver for counterfactual inference over probabilistic logic programs, based on the library of aspmc.
MIT License
5 stars 0 forks source link

Parameters of the initial example #1

Closed hector-aviles closed 7 months ago

hector-aviles commented 7 months ago

Hello, and thank you for your interest in our work. It's quite clever indeed. However, I've noticed what seems to be an issue with the truth value assignment for the command in the example related to evidence and intervention:

Original: python main.py -q slippery -e sprinkler,False -i sprinkler,True -k sharpsat-td

Revised: python3 main.py -q slippery -e sprinkler,True -i sprinkler,False -k sharpsat-td test_sprinkler.lp

To achieve the same result you provided, I had to invert the truth values. Is this correct?

Additionally, I included the ProbLog program at the end of the command. I found that trying to introduce the program through stdin didn't work for me. :(

Thanks for your kind attention. Regards,

raki123 commented 7 months ago

Thank you for raising this issue! Indeed the description in the README had inverted truth values. Sorry about that, I forgot to update after we changed the logic there. But it should be fixed now.

Regarding your second issue of reading the program from stdin: I unfortunately (or fortunately? ;-) ) cannot reproduce that. Can you try to see what happens, when you do cat test/test_sprinkler.lp | python main.py -q slippery -e sprinkler,True -i sprinkler,False -k sharpsat-td ?

hector-aviles commented 7 months ago

Dear raki123, thank you for your kind and fast response.

I realize I omitted important information. With respect to the system I'm working with, it is Ubuntu 20.04 and bash shell. I slightly modified the command you provided:

cat test_sprinkler.lp | python3 main.py -q slippery -e sprinkler,True -i sprinkler,False -k sharpsat-td

and the output is:

[WARNING] aspmc: Query for atom true was proven true during grounding. [WARNING] aspmc: Including it has a negative impact on performance. [INFO] aspmc: Tree Decomposition #bags: 18 unfolded treewidth: 3 #vertices: 20 [INFO] aspmc: Preprocessing disabled [INFO] aspmc: Stats Compilation [INFO] aspmc: ------------------------------------------------------------ [INFO] aspmc: Compilation time: 0.008137702941894531 [INFO] aspmc: Counting time: 0.0005972385406494141 [INFO] aspmc: ------------------------------------------------------------ [INFO] WhatIf: Results [INFO] WhatIf: ------------------------------------------------------------ [RESULT] WhatIf: slippery: 0.09999999999999999

Best wishes, Héctor

raki123 commented 7 months ago

Thank you for the detailed reply. If the command with cat works, then reading from stdin works in principle.

If you’re writing (or copy pasting) to stdin directly, the issue could be that you still need to terminate the input with CTRL+D (on an empty line).

hector-aviles commented 7 months ago

Thank you raki!!! Regards,