problog icon indicating copy to clipboard operation
problog copied to clipboard

problog sample not behaving as in documentation

Open theresasturn opened this issue 1 year ago • 4 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.

theresasturn avatar Apr 13 '23 21:04 theresasturn

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

theresasturn avatar Apr 13 '23 21:04 theresasturn

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

rmanhaeve avatar Apr 17 '23 07:04 rmanhaeve

Thank you for responding.

In addition to looking at Problog-2 for research purposes, I'm evaluating it for an application, along with a couple of other frameworks. The responsiveness of the Problog team is a big checkmark in its favor. know how much time that can take, believe me.

Thanks

Theresa

On Mon, 17 Apr 2023 at 03:28, Robin Manhaeve @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/ML-KULeuven/problog/issues/101#issuecomment-1510843034, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKZNEYJZ3HA2UGOMHLH3R63XBTWKZANCNFSM6AAAAAAW5T52P4 . You are receiving this because you authored the thread.Message ID: @.***>

theresasturn avatar Apr 18 '23 13:04 theresasturn

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.

sdemjanenko avatar May 11 '23 23:05 sdemjanenko