Skip to content

DC#, a hybrid probabilistic logic programming language

Notifications You must be signed in to change notification settings

niteshroyal/DC-Sharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DC#

DC# is a hybrid probabilistic logic programming (PLP) language.

It integrates the syntax of distributional clauses (DCs) and the ideas of Bayesian Logic Programs (BLPs).

It supports the combining rules, which are often required to express relational models. Combining rules are essential components of PLPs, which were not supported by the DC system.

More importantly, compared to the DC system, the inference engine of DC# is much more efficient. The inference engine now properly exploits the following three types of independencies:

  1. Conditional independencies (CIs), which are elegantly modeled in Bayesian networks.
  2. Context-specific independencies (CSIs), which are naturally represented by logical rules.
  3. Independence of causal influences (ICIs), i.e., independencies amongst attributes of related objects in relational models succinctly expressed by combining rules.

However, DC# currently does not support writing the following models, which were supported by the DC system:

  1. Dynamic probabilistic models that were expressed using Dynamic Distributional Clauses (DDCs) in the DC system.
  2. Probabilistic models with unknown objects.

It is possible to write (acyclic) ProbLog programs without Annotated Disjunction in DC#.

More details about DC# can be found in our submitted JAIR paper.

The inference engine of DC# upgrades context-specific likelihood weighting (CS-LW) to first-order programs.

Installation

This installation manual is tested on Ubuntu 18.04.4 LTS and 16.04 LTS.

  1. Install dependencies
    $ sudo apt install build-essential pkg-config libgsl-dev
  1. Install latest version of SWI-Prolog (version above 8.1.30 is required)
    $ sudo apt-add-repository ppa:swi-prolog/devel
    $ sudo apt-get update
    $ sudo apt-get install swi-prolog
  1. Build
    $ cd Sampling
    $ make clean
    $ make all

Execution

Go to Examples folder

   $ cd ../Examples/

You will find examples of DC programs. Notice the syntax of DC programs. Open one example in SWI-Prolog.

   $ swipl -s dc#_example.pl

SWI-Prolog should now be opened without any error or warnings. First, set the number of samples.

   ?- set_sample_size(10000).

Second, turn off the debug mode (1 to turn on the debug mode).

   ?- set_debug(0).

Now query. The first argument is the query, and second is the list of evidence, and P is the output probability

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

Initialization Options

display_transformed_rules/1:
	1: displays the transformed distributional clauses
	0: does not display that
set_debug/1:
	1: debug mode on, i.e., displays sampled safe contextual assignments
	0: debug mode off
set_default/1:
	0: users' responsibility to ensure that distributions for RVs are defined in each possible case.
	1: by default Boolean RVs are false if distributions for them are not defined
		(same as ProbLog and works only when all RVs are Boolean in the program).
	2: RVs are not assigned any value (assignment fails) if distributions for them are not defined
		(same as Davide's DC where RVs' value can be "undefined" in the possible world).
set_sample_size/1:
	N: number of samples	
set_time_out/1:
	0: the number of samples is used to stop sampling
	1: time (in secs) is used to stop sampling
set_combining_rule/1:
	0: no combining rule (same as Davide's DC where the first distribution defined for RV is considered)
	1: noisy-or for boolean, mixture for discrete, mixture for gaussian, none for val, none for uniform
	2: noisy-or for boolean, mixture for discrete, noisy-avg for gaussian, none for val, none for uniform
set_residual_approach/1:
            bayes_ball: set of all diagnostic evidence is computed using Bayes ball algorithm and then residuals are computed
            full: set of diagnostic evidence is estimated from samples and then residuals are computed
            biased: residuals are not computed. This approach gives biased estimates.

Help

If you need help or find a bug please write an issue or contact me at nitesh.kr (DOT) 369 (AT) gmail (DOT) com

About

DC#, a hybrid probabilistic logic programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published