Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using LFI from Python 3.8 #87

Closed
JeanChristopheRohner opened this issue Jul 3, 2022 · 3 comments
Closed

Error when using LFI from Python 3.8 #87

JeanChristopheRohner opened this issue Jul 3, 2022 · 3 comments

Comments

@JeanChristopheRohner
Copy link

Hi!

Thanks for making ProbLog :-)

When running the Parameter learning (LFI) example (found here):

from problog.logic import Term
from problog.program import PrologString
from problog.learning import lfi

model = """
t(0.5)::burglary.
0.2::earthquake.
t(_)::p_alarm1.
t(_)::p_alarm2.
t(_)::p_alarm3.

alarm :- burglary, earthquake, p_alarm1.
alarm :- burglary, \+earthquake, p_alarm2.
alarm :- \+burglary, earthquake, p_alarm3.
"""

alarm = Term('alarm')
burglary = Term('burglary')
earthquake = Term('earthquake')

examples = [
    [(burglary, False), (alarm, False)],
    [(earthquake, False), (alarm, True), (burglary, True)],
    [(burglary, False)]
]

score, weights, atoms, iteration, lfi_problem = lfi.run_lfi(PrologString(model), examples)

print (lfi_problem.get_model())

I get errors with Python 3.8.2 (with Python 2.7.16 the example works). I on MacOS 10.15.7 with ProbLog version 2.1.0.35.

With Python 3.8.2 the errors are:

Python/3.8/lib/python/site-packages/problog/ddnnf_formula.py", line 307, in _compile_with_dsharp
Python/3.8/lib/python/site-packages/problog/ddnnf_formula.py", line 360, in _compile
Python/3.8/lib/python/site-packages/problog/ddnnf_formula.py", line 355, in _compile
Python/3.8/lib/python/site-packages/problog/util.py", line 189, in subprocess_check_call
@VincentDerk
Copy link
Collaborator

VincentDerk commented Jul 3, 2022

Hi!

I am unable to reproduce the error on ProbLog 2.2.3, but perhaps it's because I'm on Ubuntu.

Does this error also occur on the newest ProbLog version (v2.2.3) for you? There have been a few changes to LFI and the dSharp binary since 2.1.0.35 that might have resolved this.

Could it be that part of the error message cut-off, you only posted the trace but not the error itself?

@JeanChristopheRohner
Copy link
Author

Thanks for the fast response. I upgraded to ProbLog 2.2.3. Now I noted that this is a known issue and how to resolve it.

@VincentDerk
Copy link
Collaborator

I was hoping the changes in v2.2.3 would have resolved that. But oke, thanks for letting us know that that is still an issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants