pymetheus

Logical Reasoning for Deep Nets


Keywords
pymetheus
License
GPL-3.0
Install
pip install pymetheus==0.3.1

Documentation

Pymetheus

Documentation Status

PyMetheus: Deep Nets for Logical Reasoning

Features

  • Provides an out of the box tool to learn (fuzz) first order logic with the use of an underlying vector space

Features

  • Create a Logic Deep Network
import pymetheus
import itertools
from pymetheus.pymetheus import LogicNet

ll = LogicNet()
  • Introduce Some Constants
ll.constant("Rome")
ll.constant("Milan")
ll.constant("Italy")
  • Introduce Some Predicates and Knowledge
ll.predicate("capital")
ll.predicate("country")

ll.knowledge("country(Milan,Italy)")
ll.knowledge("capital(Rome,Italy)")

ll.zeroing() # Initialize KB with all knowledge as false
  • Add quantified rule with data
rule = "forall ?a,?b: capital(?a,?b) -> country(?a,?b)"
ll.universal_rule(rule)
var = ["Italy", "Rome", "Milan"]
ll.variable("?a", var)
ll.variable("?b", var)
  • Learn and Reason
ll.learn(epochs=1000, batch_size=25)


ll.reason("capital(Rome,Italy)", True)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.