ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.

Home Page:https://dtai.cs.kuleuven.be/problog/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

problog sample not behaving as in documentation

theresasturn opened this issue · comments

When I type the following command:

problog sample some_heads.pl -N 3

I get as output:


someHeads.

someHeads.
(True, <generator object sample at 0x7f5f192aca50>)

rather than

====================
% Probability: 0.2

someHeads.
% Probability: 0.2

someHeads.
% Probability: 0.3

as in the documentation. I.e., no probabilities are printed out for me.

Seems to be a general problem with sample a generator object is created, but its results are not output:

Hi

It seems that the output you get is an issue with the problog-cli tool. It should not be outputted.
The documentation is also incomplete, as you need to set the --with-probabilty flag to get the desired output:

someHeads.
% Probability: 0.3
----------------
someHeads.
% Probability: 0.3
----------------
someHeads.
% Probability: 0.3
(True, <generator object sample at 0x7f714a63ae40>)

I hope this helps in the meantime.
Kind regards,
Robin

The issue appears to be sys.exit(main()) in the CLI script that pip creates. If I add this to problog-cli.py in this repo, then I can reproduce with python ./problog-cli.py sample test/sample/some_heads.pl -N 6. I am not clear on where the sys.exit(main()) is coming from. It doesn't seem to be in this repo. I see a few references:

conversions/uai2problog.py
321:    sys.exit(main())

conversions/bn2problog.py
216:    sys.exit(main())

conversions/smile2problog.py
105:    sys.exit(main())

conversions/hugin2problog.py
203:    sys.exit(main())

conversions/xmlbif2problog.py
150:    sys.exit(main())

But none of them seem to be that CLI script that gets installed.