niteshroyal / DC-Sharp

DC#, a hybrid probabilistic logic programming language
3 stars 1 forks source link

DC+ Example returns false #1

Closed VadeveSi closed 3 years ago

VadeveSi commented 3 years ago

Hi,

I'm trying to run the example after successfully running make, but I get the following output:

Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.4)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- set_sample_size(1000).
true.

?- set_debug(0).
true.

?- query((status(l_1)~=X, X==appr), [credit_score(bob)~=600, balance(a_1)~=50010], P).
false.

I'm assuming the query should result in something other than false, right?

I'm running DC+ using the latest version of Arch Linux, if that makes a difference.

Turning on debug results samples such as:

Sample# 999
-------

partial assignments:
[loan(l_1)~=true,amount(l_1)~=99614.54547592631,status(l_1)~=decl,client(bob)~=true,loan(l_3)~=true,has_loan(bob,l_3)~=true,account(a_1)~=true,has_account(bob,a_1)~=false,client(ann)~=true,has_loan(ann,l_3)~=false,has_account(ann,a_1)~=false,account_loan(a_1,l_3)~=false,has_loan(bob,l_1)~=false,has_loan(ann,l_1)~=false,account_loan(a_1,l_1)~=false,loan(l_2)~=true,has_loan(bob,l_2)~=false,has_loan(ann,l_2)~=false,account_loan(a_1,l_2)~=false,amount(l_3)~=99965.06859608661,status(l_3)~=pend,account(a_2)~=true,has_account(bob,a_2)~=false]

diagnostic evidence in this sample:
[(balance(a_1),0.0),(credit_score(bob),0.005186389905292342)]

predictive evidence in this sample:
[]

Sample# 1000
-------

partial assignments:
[loan(l_1)~=true,amount(l_1)~=100048.7154683212,status(l_1)~=decl,client(bob)~=true,loan(l_3)~=true,has_loan(bob,l_3)~=false,client(ann)~=true,has_loan(ann,l_3)~=true,account(a_1)~=true,has_account(ann,a_1)~=true,has_account(bob,a_1)~=false,has_loan(bob,l_1)~=false,has_loan(ann,l_1)~=false,account_loan(a_1,l_1)~=false,loan(l_2)~=true,has_loan(bob,l_2)~=false,has_loan(ann,l_2)~=false,account_loan(a_1,l_2)~=false,account(a_2)~=true,has_account(bob,a_2)~=true,has_account(ann,a_2)~=true,account_loan(a_2,l_1)~=false,account_loan(a_2,l_2)~=false,balance(a_2)~=25010.62458786943]

diagnostic evidence in this sample:
[(balance(a_1),0.0),(credit_score(bob),0.003983303196115372)]

predictive evidence in this sample:
[]
niteshroyal commented 3 years ago

Hi,

Fetch the new code. It should work now.

-- Nitesh

VadeveSi commented 3 years ago

Hi Nitesh, thank you for the quick response. With the latest version, I get the following:

?- query((status(l_1)~=X, X==appr), [credit_score(bob)~=600, balance(a_1)~=50010], P).
P = 0.0.

What would be the expected result?

niteshroyal commented 3 years ago

You should increase the sample size. Try 10000 samples.

Also, check how ProbLog programs are written in this system here: example

niteshroyal commented 3 years ago

And that is an expected result for a small sample size.

VadeveSi commented 3 years ago

Ah alright, great! Thank you for your time. :-)