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

Parameter learning behaviour on BN example #98

Open
plison opened this issue Feb 21, 2023 · 2 comments
Open

Parameter learning behaviour on BN example #98

plison opened this issue Feb 21, 2023 · 2 comments
Assignees

Comments

@plison
Copy link

plison commented Feb 21, 2023

I've noticed a strange result when doing parameter learning, where I get a different result depending on whether the parameter to tune is (a) directly associated with the rule or is (b) associated to a probabilistic fact included in the clauses of the rule.

From the Bayesian network example:

t(0.5)::burglary.
0.2::earthquake.
t(0.5)::p_alarm1.
t(0.5)::p_alarm2.
t(0.5)::p_alarm3.

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

with the following evidence:

evidence(burglary,false).
evidence(alarm,false).
-----
evidence(earthquake,false).
evidence(alarm,true).
evidence(burglary,true).
-----
evidence(burglary,false).

In this case, I get P(burglary) = 0.3333, P(alarm1) = 0.5, P(alarm2) = 1 and P(alarm3) = 0.

However, if I try to attach those tunable parameters to the rule directly, I do not the get the same results when running LFI on the same evidence:

t(0.5)::burglary.
0.2::earthquake.

t(0.5)::alarm :- burglary, earthquake.
t(0.5)::alarm :- burglary, \+earthquake.
t(0.5)::alarm :- \+burglary, earthquake.

P(burglary) is still equal to 0.3333 and P(alarm2) is still equal to 1, but this time the probability of the first alarm is set to 0, even though no case of burglary + alarm was observed in the evidence (so the probability should not be modified from the initial 0.5).

Any idea why this is the case?

@rmanhaeve
Copy link
Contributor

Hi Pierre. This seems to be a bug indeed. We'll look into it.

@wenchiyang
Copy link
Contributor

Thank you for your input!
It is indeed a bug that the algorithm blindly assigns a 0 to parameters whose value cannot be inferred in the evidence instead of choosing not to update, just like p_alarm1 in your illustration. I have fixed it here which will soon be integrated in the current repo as well.

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

3 participants