Skip to main content

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 https://lirias.kuleuven.be/handle/123456789/499989. 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.

Installation

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.

Usage

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:

probfoil data.pl

or, in the repository version

python probfoil/probfoil.py data.pl

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

Target

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

Modes

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

Types

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

example_mode(auto).

Example

% Modes
mode(male(+)).
mode(parent(+,+)).
mode(parent(+,-)).
mode(parent(-,+)).

% Type definitions
base(parent(person,person)).
base(male(person)).
base(female(person)).
base(mother(person,person)).
base(grandmother(person,person)).
base(father(person,person)).
base(male_ancestor(person,person)).
base(female_ancestor(person,person)).

% Target
learn(grandmother/2).

% How to generate negative examples
example_mode(auto).

Further examples can be found in the directory examples.

Release files for probfoil 2.1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for probfoil 2.1.0.3
File Size Uploaded
probfoil-2.1.0.3.tar.gz 15.6 kB Details

Release files / probfoil-2.1.0.3.tar.gz

Download URL probfoil-2.1.0.3.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
08f5ad5006f39eecc15f3efaa3e645dc8691504ea7d5bbe8c70c69d29bf7b902
BLAKE2b-256 checksum
How to use checksums
6f4cff52cde42e59be2599aa234f4248ceeea03e9801e1c686b34190f0f2210b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page