Skip to content
krivard edited this page Nov 14, 2014 · 5 revisions

Logic Program Exception

edu.cmu.ml.praprolog.prove.LogicProgramException: Error converting features of rule ...

This happens because ProPPR couldn't bind the variables used in the features of a rule. Remember that the variables in a feature must be bound in the head of the rule -- the body is too late.

Let's say we want to be able to call associatedWith(bear,X) and learn whether the word "bear" is associated with each of our categories, which will be subbed in for X. We have a facts file that lists all the categories, called isCategory.

This rule won't work:

 associatedWith(Word,Category) :- isCategory(Category) # f(Word,Category) .

...because Category isn't being bound until the isCategory lookup in the body of the rule.

To fix it: move the feature down a level.

 associatedWith(Word,Category) :- isCategory(Category),learn(Word,Category) .
 learn(Word,Category) :- # f(Word,Category) .

Now when we call associatedWith(bear,X), X is bound by isCategory, and then we call e.g. learn(bear,zoology) and can use those values for the feature f.

MinAlpha Exception

edu.cmu.ml.praprolog.prove.MinAlphaException: minAlpha too high! Did you remember to set alpha in logic program components? dpr minAlpha =0.1 localAlpha=0.08333333333333333 for state ...

This can happen if (1) you're using the default prover and (2) your graph has a fanout of 10 or more.

Background: alpha is the probability of reset, and minAlpha is the bound on that probability that makes our pagerank approximation possible. Unfortunately, if you get this error it means our pagerank approximation is no longer accurate and any results you get are basically garbage.

The default minAlpha is 0.1, or 1/10. This means if any node in the graph has more than 10 outgoing edges, the reset probability is going to fall below 1/10, and violate the constraint.

To fix it: Set minalpha according to your graph in your prover specification. If you know the maximum fanout of your graph (i.e. the maximum out-degree of a node), you can use 1/that for minalpha. Otherwise, look at the localAlpha part of the error message, and pick a number lower than that to use for minalpha. In the example above, 0.08 would be fine. It's a good idea to use the same minalpha value for all your examples, so if you see multiple errors like this, pick the lowest localAlpha value to base your new minalpha off of.

To set minalpha on a dpr prover (the default), use --prover dpr:{epsilon}:{minalpha} on the command line. [epsilon is the error bound on the approximation; if you're not sure what to put there use 1e-5]