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

Julia front-end for ProbLog through PyCall #46

Open
femtomc opened this issue Jul 28, 2020 · 5 comments
Open

Julia front-end for ProbLog through PyCall #46

femtomc opened this issue Jul 28, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@femtomc
Copy link

femtomc commented Jul 28, 2020

Hello! My name is McCoy - I work on probabilistic programming in Julia.

I'd like to write a small front-end which can access the ProbLog Python API through Julia. There's a number of Julia packages which I will use to do this, the most prominent is PyCall.jl which I think will provide most of the interlinking.

This work will occur at Problox.jl.

I'd just like to keep this issue open, so that I may ask questions as I proceed.

Also, if there's a lower level C API which ProbLog offers, I'd like to read up on that as well if that's available somewhere. I know the knowledge compilation occurs in C - but I was unsure about the rest of the system.

@femtomc
Copy link
Author

femtomc commented Jul 28, 2020

I have an initial version working with a simple coin flip example now. I'm sure questions may arise as I try to use some of the more advanced concepts.

@VincentDerk
Copy link
Collaborator

Hi,

Great to hear you managed to get an initial working version so fast!

In terms of things that aren't done in Python,

  • the engine (logical inference) is currently completely done in Python but there have been some investigations into outsourcing this back to other Prolog engines (cf. new-engine branch). (@rmanhaeve , @sebdumancic)
  • the knowledge compilation with d-DNNF is done by calling a binary (dsharp) and reading its output.
  • the knowledge compilation with SDD is done by using a Python wrapper around the SDD package written in C (PySDD).
  • and there might be things I'm less familiar with and missed (like the maxsat binary used in the MPE or MAP task, I can't remember exactly).

@femtomc
Copy link
Author

femtomc commented Jul 29, 2020

Is the investigation into other backends motivated by performance questions?

I was curious about this. I'm hoping to attempt to hook this system up to a trace-based system (like Gen.jl) which means inference in the combined model might involved repeated sampling, and then querying.

Thanks for responding so quickly!

Last question: is there a notion of "noisy And"? I don't think this really makes sense, but I'm really asking about the joint query. Initially I thought a statement like:

smokes(X) :- friend(X,Y), influences(Y,X), smokes(Y).

was sort of like a CPD, but I think from my reading that this is really a sort of disjunction. Is that correct?

@VincentDerk
Copy link
Collaborator

Is the investigation into other backends motivated by performance questions?

Yes. In theory the knowledge compilation should be the most expensive step. In practice, we found that for some problems the engine (grounding) takes a lot of time. This has already been alleviated a bit in the develop branch but still, a Prolog engine in C might yield even more improvements.

Last question

I'm afraid I don't fully understand your question. The rule smokes(X) :- friend(X,Y), influences(Y,X), smokes(Y). means that anytime the body holds (conjunction), the head is true.

Personally, I like to reason over these programs as a combination of rules that can make something true. A weighted model counting perspective can also help. Consider the following program:

0.5::smokes(bob).
0.2::smokes(ann).
smokes(X) :- friend(X,Y), smokes(Y).
friend(bob,ann).
friend(ann,bob).
query(smokes(ann)).

smokes(ann) is either true because of the second rule (0.2) or because of the third and first rule (0.5).
query(smokes(ann)) = 0.2 + (1-0.2) * 0.5

Hope that helps.

@femtomc
Copy link
Author

femtomc commented Jul 29, 2020

@VincentDerk That helps tremendously. Thank you.

@VincentDerk VincentDerk added the enhancement New feature or request label May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants