Skip to main content

Prob2FOIL: rule learner for probabilistic logic

Project description

ProbFOIL is a probabilistic extension of FOIL that is capable of learning probabilistic rules from probabilistic data.

ProbFOIL 2.1 is a redesign of the Prob2FOIL algorithm that was introduced in It works on top of ProbLog 2.1.

If you are looking for the version used in the paper, you should check out the tag paper_version.


ProbFOIL 2.1 requires ProbLog 2.1. You can install ProbLog by using the command:

pip install problog

ProbFOIL does not require any further installation.


The input of ProbFOIL consists of two parts: settings and data. These are both specified in Prolog (or ProbLog) files, and they can be combined into one.

The data consists of (probabilistic) facts. The settings define

  • target: the predicate we want to learn

  • modes: which predicates can be added to the rules

  • types: type information for the predicates

  • other settings related to the data

To use:


or, in the repository version

python probfoil/

Multiple files can be specified and the information in them is concatenated. (For example, it is advisable to separate settings from data).

Several command line arguments are available. Use --help to get more information.

Settings format


The target should be specified by adding a fact learn(predicate/arity).


The modes should be specified by adding facts of the form mode(predicate(mode1, mode2, ...), where modeX is the mode specifier for argument X. Possible mode specifiers are:

  • +: the variable at this position must already exist when the literal is added

  • -: the variable at this position does not exist yet in the rule (note that this is stricter than usual)

  • c: a constant should be introduced here; possible value are derived automatically from the data


For each relevant predicate (target and modes) there should be a type specifier. This specifier is of the form base(predicate(type1, type2, ...), where typeX is a type identifier. Type can be identified by arbitrary Prolog atoms (e.g. person, a, etc.)

Example generation

By default, examples are generated by quering the data for the target predicate. Negative examples can be specified by adding zero-probability facts, e.g.:

0.0::grandmother(john, mary).

Alternatively, ProbFOIL can derive negative examples automatically by taking combinations of possible values for the target arguments. Note that this can lead to a combinatorial explosion. To enable this behavior, you can specify the fact



% Modes

% Type definitions

% Target

% How to generate negative examples

Further examples can be found in the directory examples.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

probfoil- (15.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page