ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.
https://dtai.cs.kuleuven.be/problog/
298 stars 34 forks source link

Negative evidence when learning annotated disjunctions params #52

Closed lewtds closed 3 years ago

lewtds commented 3 years ago

Hi. Aren't elements in an annotated disjunctions supposed to be mutually exclusive? Apparently, when learning the params, I still have to provide the negative evidences for the other alternatives. Otherwise, the propabilities come up being equal.

Example:

% model.pl
t(_)::f(a); t(_)::f(b); t(_)::f(c).

% evidence.ev
evidence(f(a)).
---
evidence(f(a)).
---
evidence(f(b)).
---
evidence(f(b)).
---
evidence(f(c)).
---

With lfi --normalize, the result is [0.33333333, 0.33333333, 0.33333333]. I expect [0.4, 0.4, 0.2].

If I change it to this then it works correctly:

% model.pl
t(_)::f(a); t(_)::f(b); t(_)::f(c).

pairwise_true :- f(a), f(b).
pairwise_true :- f(b), f(c).
pairwise_true :- f(c), f(a).

% evidence.ev
evidence(f(a)).
evidence(pairwise_true, false).
---
evidence(f(a)).
evidence(pairwise_true, false).
---
evidence(f(b)).
evidence(pairwise_true, false).
---
evidence(f(b)).
evidence(pairwise_true, false).
---
evidence(f(c)).
evidence(pairwise_true, false).
---

Thanks!

wenchiyang commented 3 years ago

Which branch and commit are you using? I tried with the up-to-date master branch and got the correct result. See https://dtai.cs.kuleuven.be/problog/editor.html#task=lfi&hash=0c5c2f50ff039c30017da8796a95e906&ehash=0c26480cab02e6bf4608c5fa7621074f

On 16 Dec 2020, at 09:16, Trung Ngo notifications@github.com<mailto:notifications@github.com> wrote:

Hi. Aren't elements in an annotated disjunctions supposed to be mutually exclusive? Apparently, when learning the params, I still have to provide the negative evidences for the other alternatives. Otherwise, the propabilities come up being equal.

Example:

% model.pl t()::f(a); t()::f(b); t(_)::f(c).

% evidence.ev evidence(f(a)).

evidence(f(a)).

evidence(f(b)).

evidence(f(b)).

evidence(f(c)).

With lfi --normalize, the result is [0.33333333, 0.33333333, 0.33333333]. I expect [0.4, 0.4, 0.2].

If I change it to this then it works correctly:

% model.pl t()::f(a); t()::f(b); t(_)::f(c).

pairwise_true :- f(a), f(b). pairwise_true :- f(b), f(c). pairwise_true :- f(c), f(a).

% evidence.ev evidence(f(a)). evidence(pairwise_true, false).

evidence(f(a)). evidence(pairwise_true, false).

evidence(f(b)). evidence(pairwise_true, false).

evidence(f(b)). evidence(pairwise_true, false).

evidence(f(c)). evidence(pairwise_true, false).

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ML-KULeuven/problog/issues/52, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALJYBM3VMMP65D6TY6W2XZ3SVAC7XANCNFSM4U5G7Z6A.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/ML-KULeuven/problog/issues/52", "url": "https://github.com/ML-KULeuven/problog/issues/52", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

lewtds commented 3 years ago

I'm using the lastest develop branch. This commit https://github.com/ML-KULeuven/problog/commit/bc5d9f7be49e9a001b8b59989e8997821756b090

lewtds commented 3 years ago

I'm not on my laptop now. I'll double check with master and post the exact command + env later.

wenchiyang commented 3 years ago

Ohh that’s the issue. The develop branch is not up-to-date with the LFI feature. The stable LFI is in the master branch, the develop LFI is the feature/lficont branch.

On 16 Dec 2020, at 11:29, Trung Ngo notifications@github.com<mailto:notifications@github.com> wrote:

I'm not on my laptop now. I'll double check with master and post the exact command + env later.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ML-KULeuven/problog/issues/52#issuecomment-745740421, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALJYBM6HYLC2EAGDUGSUYLDSVASRHANCNFSM4U5G7Z6A.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/ML-KULeuven/problog/issues/52#issuecomment-745740421", "url": "https://github.com/ML-KULeuven/problog/issues/52#issuecomment-745740421", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

lewtds commented 3 years ago

Thanks again! I can confirm that it works on master. But on lficont, it gives me 0.4::f(a); 0.4::f(a); 0.4::f(b); 0.4::f(b); 0.2::f(c). Maybe you can take a look on that.

wenchiyang commented 3 years ago

Yes. The newest commit on LFI is wrong (work in progress), please rollback to fff2178ce7a5f983dbc7a0618120bfe9ad5f2b21

On 16 Dec 2020, at 20:52, Trung Ngo notifications@github.com<mailto:notifications@github.com> wrote:

Thanks again! I can confirm that it works on master. But on lficont, it gives me 0.4::f(a); 0.4::f(a); 0.4::f(b); 0.4::f(b); 0.2::f(c). Maybe you can take a look on that.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ML-KULeuven/problog/issues/52#issuecomment-746243343, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALJYBM6FGS3DV2SZCC7RYNTSVCUP5ANCNFSM4U5G7Z6A.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/ML-KULeuven/problog/issues/52#issuecomment-746243343", "url": "https://github.com/ML-KULeuven/problog/issues/52#issuecomment-746243343", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]