Clone the LTN repository and install it using pip install -e <local project path>.
Following are the dependencies we used for development (similar versions should run fine):
- python 3.8
- tensorflow >= 2.2 (for running the core system)
- numpy >= 1.18 (for examples)
- matplotlib >= 3.2 (for examples)
logictensornetworks/core.py-- core system for defining constants, variables, predicates, functions and formulas,logictensornetworks/fuzzy_ops.py-- a collection of fuzzy logic operators defined using Tensorflow primitives,logictensornetworks/utils.py-- a collection of useful functions,tutorials/-- tutorials to start with LTN,examples/-- various problems approached using LTN,tests/-- tests.
tutorials/ contains a walk-through of LTN. In order, the tutorials cover the following topics:
- Grounding in LTN part 1: Real Logic, constants, predicates, functions, variables,
- Grounding in LTN part 2: connectives and quantifiers (+ complement: choosing appropriate operators for learning),
- Learning in LTN: using satisfiability of LTN formulas as a training objective,
- Reasoning in LTN: measuring if a formula is the logical consequence of a knowledgebase.
The tutorials are implemented using jupyter notebooks.
examples/ contains a series of experiments. Their objective is to show how the language of Real Logic can be used to specify a number of tasks that involve learning from data and reasoning about logical knowledge. Examples of such tasks are: classification (binary_classification, multiclass_classification, mnist), regression, clustering, link prediction (smokes_friends_cancer, parent_ancestor).
The examples are presented with both jupyter notebooks and Python scripts.
This project is licensed under the MIT License - see the LICENSE file for details.
LTN has been developed thanks to active contributions and discussions with the following people (in alphabetical order):
- Alessandro Daniele (FBK)
- Artur d’Avila Garces (City)
- Benedikt Wagner (City)
- Emile van Krieken (VU Amsterdam)
- Francesco Giannini (UniSiena)
- Giuseppe Marra (UniSiena)
- Ivan Donadello (FBK)
- Lucas Brukberger (UniOsnabruck)
- Luciano Serafini (FBK)
- Marco Gori (UniSiena)
- Michael Spranger (Sony AI)
- Michelangelo Diligenti (UniSiena)
- Samy Badreddine (Sony AI)