linqs / psl-examples

Various examples to showcase the functionality of PSL.
61 stars 38 forks source link

Question regarding the use of "predicate_closed=True" in the examples #19

Closed liu-yang-maker closed 1 year ago

liu-yang-maker commented 1 year ago

I have been reviewing the examples provided in the project and noticed that in all the examples, the predicate is consistently set as "predicate_closed=True". I would like to understand the rationale behind this choice and its implications for the project.

Could you example whether it should to distinguish the predicate as open or closed? Why the target predicate also set as "open"? Could you please provide some insights? Thanks a lot.

eriq-augustine commented 1 year ago

Hey,

When we are talking about open vs closed predicates, we are really talking about the types of variables (unobserved vs observed) that the predicate produces.

Closed predicates can only produce atoms that are observed. Closed predicates have a closed-world assumption applied to them, so any ground atom that uses a closed predicate and does not have an explicitly defined value takes on a value of 0.0 (false). These semantics are very similar to other SRL frameworks/languages (like MLNs) and other probabilistic programming in-general.

Open predicates can have both observed and unobserved values, and does not have the closed world assumption applied to them. For open predicates, all reachable atoms (atoms that may be used in a ground rule) has to be specified. To see a predicate that has both observed and unobserved data, you can look at the simple-acquaintances example. You can see in the data file for the most recent release, that "Knows" is marked as open and has data loaded into both "observations" (observed data) and "targets" (unobserved data). (Also note that the new configuration format used in the next release does not explicitly state open/closed, but instead infers that information from the data provided.)

For reference, you can see the canonical PSL paper (Section 4.1.2).

Hope this helps.

liu-yang-maker commented 1 year ago

Thanks for your reply!!!