ArticleslgStudy

computer science

ProbLog

ProbLog is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand ProbLog rather than just read about it. In short: ProbLog is a probabilistic logic programming language that extends Prolog with probabilities. It minimally extends Prolog by adding the notion of a probabilistic fact, which combines the idea of logical atoms and random variables.

Key takeaways

  • ProbLog belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect ProbLog to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of ProbLog from memory before moving on to harder problems.

Reference excerpt

ProbLog is a probabilistic logic programming language that extends Prolog with probabilities. It minimally extends Prolog by adding the notion of a probabilistic fact, which combines the idea of logical atoms and random variables. Similarly to Prolog, ProbLog can query an atom. While Prolog returns the truth value of the queried atom, ProbLog returns the probability of it being true.

Semantics A probabilistic fact is a pair ( p , a ) {\displaystyle (p,a)} with a {\displaystyle a} a ground atom and p ∈ [ 0 , 1 ] {\displaystyle p\in [0,1]} the probability of a {\displaystyle a} being true. A rule is defined by an atom h {\displaystyle h} , called the head, and a finite set of n {\displaystyle n} literals { b 1 , b 2 , . . . , b n } {\displaystyle \{b_{1},b_{2},...,b_{n}\}} , called the body. ProbLog programs consist of a set of probabilistic facts F {\displaystyle {\mathcal {F}}} and a set of rules R {\displaystyle {\mathcal {R}}} . Using the distribution semantics, a probability distribution is defined over the two-valued well-founded models of the atoms in the program. The probability of a model is defined as P ( M ) = ∏ l ∈ M P ( l ) {\displaystyle P(M)=\prod _{l\in M}P(l)} where the product runs over all the literals in the model M {\displaystyle M} . For a query atom q {\displaystyle q} the distribution semantics defines a probability for the query

P ( q ) = ∑ M ⊨ q P ( M ) = ∑ M ⊨ q ∏ l ∈ M P ( l ) {\displaystyle P(q)=\sum _{M\models q}P(M)=\sum _{M\models q}\prod _{l\in M}P(l)}

in which the sum runs over all the models where q {\displaystyle q} is true. ProbLog supports multiple tasks:

Probabilistic inference: calculate P ( q ) {\displaystyle P(q)}

Most probable explanation: calculate the most probable model probability max M ⊨ q P ( M ) {\displaystyle \max _{M\models q}P(M)}

Sampling: generate samples of q {\displaystyle q}

Learning from interpretations: learn the probabilities of ProbLog programs from data

Example ProbLog can for example be used to calculate the probability of getting wet given the probabilities for rain and the probabilities that someone brings an umbrella as follows:

The last rule before the query states that someone gets wet if it rains and no umbrella was brought. When ProbLog is asked to solve the "probabilistic inference" task, the query asks for the probability to stay dry on a weekend day. When solving the "most probable explanation" task, ProbLog will return the most likely reason for staying dry, i.e. because it is not raining or because the person has an umbrella.

Implementations The ProbLog language has been implemented as a YAP Prolog library (ProbLog 1). and as a stand-alone Python framework (ProbLog 2) The source code of ProbLog 2 is licensed under Apache License, Version 2.0 and available on GitHub. The ProbLog language has also been implemented as part of the cplint probabilistic logic programming package for SWI-Prolog, YAP and XSB.

ProbLog variants ProbLog has been extended or used as inspiration for several different variants, including:

DeepProbLog extends ProbLog by allowing the probability to be parametrized by a neural network. DTProblog extends ProbLog with decision theory. The utility of a strategy is defined as the expected reward for its execution in the presence of probabilistic effects. DC-ProbLog extends ProbLog with distributional facts, meaning that instead of probabilities, a logic atom has a corresponding continuous probability distribution instead. aProbLog generalizes ProbLog by allowing any commutative semiring instead of just probabilities. ProbFOIL: given a set of ProbLog facts as a probabilistic relational database, ProbFOIL finds a set of probabilistic rules to predict the facts of one relation based on all other relations.

Related languages PRISM: Programming in statistical modeling ICL: Independent Choice Logic CP-Logic: Language of causal probabilistic events LPAD: Logic programs with annotated disjunctions Distributional clauses: A probabilistic logic language for hybrid relational domains

Further reading ProbLog homepage ProbLog docs ProbLog repository

References

Worked examples

Example 1 — a first encounter with ProbLog

Start with the simplest possible case. Write down what ProbLog claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to ProbLog before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about ProbLog ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of ProbLog

In research
ProbLog appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses ProbLog in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
ProbLog is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational statistics, Logic programming languages, Nondeterministic programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for ProbLog outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study ProbLog in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what ProbLog means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain ProbLog out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is ProbLog in simple terms?

ProbLog is a probabilistic logic programming language that extends Prolog with probabilities. It minimally extends Prolog by adding the notion of a probabilistic fact, which combines the idea of logical atoms and random variables.

Why does ProbLog matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study ProbLog?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on ProbLog.

Tags

  • Computational statistics
  • Logic programming languages
  • Nondeterministic programming languages
  • Probabilistic software
  • Programming paradigms
  • Python (programming language) scientific libraries

Keep exploring