Deep Learning and Logical Reasoning from Data and Knowledge
Logic Tensor Network (LTN) is a neurosymbolic framework that supports querying, learning and reasoning with both rich data and rich abstract knowledge about the world. LTN uses a differentiable first-order logic language, called Real Logic, to incorporate data and logic. The figure below describes features of Real Logic.
The example page gives a non-exhaustive list of projects that use LTN. Also, check out the PyTorch implementation.
LTN converts Real Logic formulas (e.g. ∀x(cat(x) → ∃y(partOf(x,y)∧tail(y)))
) into TensorFlow computational graphs.
Such formulas can express complex queries about the data, prior knowledge to satisfy during learning, statements to prove ... The next two figures describe how Real Logic sentences can represent computational graphs (inputs are on the left, outputs are on the right).
Cite as:
@article{badreddine2022logic,
title = {Logic Tensor Networks},
journal = {Artificial Intelligence},
volume = {303},
pages = {103649},
year = {2022},
issn = {0004-3702},
doi = {https://doi.org/10.1016/j.artint.2021.103649},
author = {Samy Badreddine and Artur {d'Avila Garcez} and Luciano Serafini and Michael Spranger},
keywords = {Neurosymbolic AI, Deep learning and reasoning, Many-valued logics}
}
For the latest release version, install via pip. To install the core dependencies, run:
pip install ltn
If you need the dependencies used in the examples, run:
pip install ltn[examples]
For the latest development version, clone the github repository and install it locally (with or without dependency modifier).
pip install -e <local project path>
ltn/core.py
-- core system for defining constants, variables, predicates, functions and formulas,ltn/fuzzy_ops.py
-- a collection of fuzzy logic operators defined using Tensorflow primitives,ltn/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:
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, regression, clustering, link prediction.
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):