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

ASEO inference errors for non-grounded predicates #10

Open
famitzsy8 opened this issue Sep 2, 2024 · 1 comment
Open

ASEO inference errors for non-grounded predicates #10

famitzsy8 opened this issue Sep 2, 2024 · 1 comment

Comments

@famitzsy8
Copy link

For a very simple (and stratified) program like:

mango_seller(1..3).

0.5::deal(X, Y) :- mango_buyer(X), mango_seller(Y).

was_deal :- deal(X, Y).

#query(was_deal).

we get non-converging inference errors with ASEO as opposed to the same program with the predicate was_deal grounded:

mango_seller(1..3).

0.5::deal(X, Y) :- mango_buyer(X), mango_seller(Y).

was_deal :- deal(1, 1).
was_deal :- deal(1, 2).
was_deal :- deal(1, 3).
was_deal :- deal(2, 1).
was_deal :- deal(2, 2).
was_deal :- deal(2, 3).
was_deal :- deal(3, 1).
was_deal :- deal(3, 2).
was_deal :- deal(3, 3).


#query(was_deal).
  • Weirdly enough this inference error phenomenon doesn't always occur when we use non-grounded predicates, e.g. in the case of the graph coloring program and the fail condition:
fail :- edge(X, Y), color(X, C), color(Y, C).

Note that this program is non-stratified.

Inference Errors by number of models

The Program with the one non-grounded predicate

nongrounded

The program with predicate grounded

grounded

And for the graph coloring problem

graphcol

@RenatoGeh
Copy link
Member

After some debugging I think I have found the source of this error. The issue is that we are not grounding any rules that have probabilistic facts in the body before doing inference.

Let's look at a minimal example:

0.5::f(1).
0.5::f(2).
a :- f(X).
#query a.

When doing exact inference, we have access to each total choice and thus can do "pregrounding": we know the values of f(1) and f(2) for a given total choice and so we can add them (or not) to the program as purely logic facts. We then do the usual grounding to get a :- f(1) and a :- f(2). This is doable because we create a new logic program for each total choice and then do inference on this purely logic program.

However, when doing ASEO we fix a single program and then optimize for a given loss function (proportional to the probabilities of probabilistic facts). For this reason, we cannot do pregrounding the same way. I'm unsure on how to properly do pregrounding such that for each iteration of ASEO (i.e. each function call of pasp/caseo.c:aseo_solve) we do not generate an inconsistent program.

An obvious solution would be to take every logic rule in the program and ground them exhaustively; this is probably an inefficient and implementation heavy way to do this though.

Another would be to use gringo: first assume all probabilistic facts to be logic facts, and then ground with gringo. I believe this will generate all the grounded rules we need.

In any case, this issue will require time to both read through the clingo documentation and come up with an efficient way to code this into our current implementation.

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