-
Notifications
You must be signed in to change notification settings - Fork 0
Example: Lives & Knows
A very simple project demonstrating how to use the psl-infrastructure and psl-ragviewer packages.
This demo project is based on a PSL problem for inferring whether a pair of people knows each other based on information whether they share the same address.
We have two predicates:
-
LivesPred:
Lives(P,L)-- "Person P lives at address L" -
KnowsPred:
Knows(P1,P2)-- "Person P1 knows person P2"
Both predicate classes contain templates for describing a ground atom as a noun phrase ("Alice knowing Bob") or a sentence ("Alice probably knows Bob").
The SampleConstantRenderer provides pretty-print functions for some of the atom arguments.
We have one weighted logical rule and one arithmetic constraint:
-
LivesToKnowsRule:
1.0: Lives(P1,L) & Lives(P2,L) & (P1 != P2) -> Knows(P1,P2)-- "If there is evidence that two people live at the same address, this makes it more likely that they know each other." -
KnowsSymmetryConstraint:
Knows(P1,P2) = Knows(P2,P1).-- "The knows relationship is symmetric."
Each rule overrides the method generateExplanation to provide explanation templates that match the rule logic more naturally than the default explanations might.
TODO
TODO