We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From the Usage page I have abstracted the following code
from lnn import Predicates from lnn import Variables from lnn import Implies, Equivalent from lnn import World from lnn import Fact Smokes, Cancer = Predicates('Smokes', 'Cancer') Friends = Predicates('Friends', arity=2) x, y = Variables('x', 'y') Smoking_causes_Cancer = Implies(Smokes(x), Cancer(x)) Smokers_befriend_Smokers = Implies(Friends(x, y), Equivalent(Smokes(x), Smokes(y))) formulae = [ Smoking_causes_Cancer, Smokers_befriend_Smokers ] model.add_knowledge(*formulae, world=World.AXIOM) # add data to the model model.add_data({ Friends: { ('Anna', 'Bob'): Fact.TRUE, ('Bob', 'Anna'): Fact.TRUE, ('Anna', 'Edward'): Fact.TRUE, ('Edward', 'Anna'): Fact.TRUE, ('Anna', 'Frank'): Fact.TRUE, ('Frank', 'Anna'): Fact.TRUE, ('Bob', 'Chris'): Fact.TRUE}, Smokes.name: { 'Anna': Fact.TRUE, 'Edward': Fact.TRUE, 'Frank': Fact.TRUE, 'Gary': Fact.TRUE}, Cancer.name: { 'Anna': Fact.TRUE, 'Edward': Fact.TRUE} }) model.print()
I added a comma in the formulae. When I run this, I get
formulae
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In [17], line 27 23 model.add_knowledge(*formulae, world=World.AXIOM) 26 # add data to the model ---> 27 model.add_data({ 28 Friends: { 29 ('Anna', 'Bob'): Fact.TRUE, 30 ('Bob', 'Anna'): Fact.TRUE, 31 ('Anna', 'Edward'): Fact.TRUE, 32 ('Edward', 'Anna'): Fact.TRUE, 33 ('Anna', 'Frank'): Fact.TRUE, 34 ('Frank', 'Anna'): Fact.TRUE, 35 ('Bob', 'Chris'): Fact.TRUE}, 36 Smokes.name: { 37 'Anna': Fact.TRUE, 38 'Edward': Fact.TRUE, 39 'Frank': Fact.TRUE, 40 'Gary': Fact.TRUE}, 41 Cancer.name: { 42 'Anna': Fact.TRUE, 43 'Edward': Fact.TRUE} 44 }) 45 model.print() File ~/src/pas-notebooks/env/lib64/python3.9/site-packages/lnn/model.py:346, in Model.add_data(self, data) 344 for formula, fact in data.items(): 345 if not isinstance(formula, Formula): --> 346 raise TypeError( 347 "formula expected of type Formula, received " 348 f"{formula.__class__.__name__}" 349 ) 350 _exceptions.AssertFormulaInModel(self, formula) 351 if formula.propositional: TypeError: formula expected of type Formula, received str
The text was updated successfully, but these errors were encountered:
I would like to note that the construction syntax seems pretty different than the Jupyter notebooks in the Examples folder.
Sorry, something went wrong.
No branches or pull requests
From the Usage page I have abstracted the following code
I added a comma in the
formulae
. When I run this, I getThe text was updated successfully, but these errors were encountered: