Skip to content

Latest commit

 

History

History
51 lines (33 loc) · 3.54 KB

README.md

File metadata and controls

51 lines (33 loc) · 3.54 KB

PSL Infrastructure

This library provides an API for the Probabilistic Soft Logic (PSL) framework to allow programmatically defining PSL problems as well as using several other functionalities:

Features

Rule-atom Graph

Each PSL problem's RuleAtomGraph (the graph connecting a ground rule with the associated ground atoms) is extracted after the inference is complete.

  • The method putsPressureOnGrounding indicates whether a given ground rule is active with respect to the value of a given ground atom in the MAP state.
  • distanceToSatisfaction returns a grounding's distance to satisfaction.
  • getCounterfactual provides information on whether a given ground rule would be violated if the score of a given atom were modified slightly.

Talking rules/constraints and predicates

The subpackages talk, talk.pred, and talk.rule allow the definition of PSL problems with human-understandable inference explanations.

If you define a custom rule class, it needs to extend one of the following classes:

  • TalkingLogicalRule: weighted logical rules
  • TalkingLogicalConstraint: logical constraints
  • TalkingArithmeticRule: weighted arithmetic rules
  • TalkingArithmeticConstraint: arithmetic constraints

Overriding a rule's generateExplanation code allows creating custom templates for explaining the rule's logic in the context of a selected associated ground atom. Otherwise, the rule is verbalized using according to a default paradigm.

To create predicates that can easily be rendered as noun phrases or sentences, extend the TalkingPredicate class.

Grounding

Extend the PslProblem class to declare the predicates and rules that should be used for an inference. Extend the IdeaGenerator to write code for generating ground atoms.

Parallel inferences

The PartitionManager allows for several PSL inferences to be run at once if they use disjoint sets of (target) atoms. (We are also working on a queuing mechanism for problems with overlapping atom sets.)

Model evaluations

The eval package allows evaluating inference results against a gold standard.

Example

Please refer to the repository's wiki for a walkthrough of a simple sample project.

Related libraries

The psl-ragviewer library contains code for inspecting the inference results created with the code in this repository in a GUI.