You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KBestJanusGrounder chooses a branch of an annotated disjunction for each ground instance of the variables its branches share, as Solver does. It made one choice for the whole disjunction, so nn(sym, [X], Y, [0..1]) :: symbol(X,Y)., the spelling the DeepProbLog notebook teaches, chose one symbol for every image: g(A,B) :- symbol(i0,A), symbol(i1,B). had only the answers g(0,0) and g(1,1), and each of their formulas read symbol(i1,_) as already chosen, so it held the leaf of symbol(i0,_) alone and the probability of g(1,1) was that of symbol(i0,1). An enumerated disjunction with variables, such as 0.3::a(X); 0.7::b(X)., was one choice in the same way. A program that worked around this by writing out each image's disjunction gives the same results as before.
KBestJanusGrounder(k) keeps up to k proofs for each answer to a query, as its docstring says, where it kept k proofs in all. A query with variables lost answers: over the edges 0.4::edge(a,b), 0.5::edge(b,c), 0.6::edge(a,c) and 0.9::edge(c,d), ?- path(a,X). had the one answer path(a,c) with k=1, and lacked path(a,b) with k=2. Scallop's top-k proofs are per tuple in the same way. A ground query has one answer, and is searched as before. This changes what a query with variables returns, and what it costs. The search drops a partial proof once its answer is ground and has k proofs, and goes on until no partial proof is left, so where each proof fixes its answer only at its end, as value(V) does over the parses of a formula, it now expands every proof where it stopped after k.
A stack overflow in JanusGrounder or KBestJanusGrounder raises MemoryError, and KBestJanusGrounder's says why its search ran out. JanusProver.query read every error back from its text with DeepLog's Prolog parser, which failed on the frames a stack overflow lists, so the overflow surfaced as ValueError: "stack:[frame(9343, ...)]" continues after the bracket closing its arguments. It now matches the errors it translates as Prolog terms, and raises MemoryError for one that runs out of Prolog's memory, such as its stack limit (1 GB by default). KBestJanusGrounder keeps every partial proof it has yet to expand, which is most of them where probabilities tell them apart little, as an untrained network's do, and it does not table its calls, so it expands a goal that calls itself before its proof holds a new fact, as the left-recursive path(X,Y) :- path(X,Z), edge(Z,Y). does, without end. Its error and its docstring now say so. JanusGrounder tables its calls and proves such a program.