Open mgualti opened 12 hours ago
Hi,
Yeah, there is an (annoying!) problem with SWI-Prolog. It maintains its state even when it should not. Sorry about that.
Is there a way to reset the examples that are stored in the Prolog session, or, better yet, reset everything?
Not easily. The simplest thing is to create a new Python process each time you create a Popper instance.
Kind regards,
Andrew
On 15 Nov 2024, at 03:13, Marcus Gualtieri @.***> wrote:
I'm trying to run Popper from Python in a loop like this: for i in range(len(examples_file_names)):
popper_settings = popper.util.Settings( bias_file = bias_file_name, bk_file = background_file_name, ex_file = examples_file_names[i]) prog, score, stats = popper.loop.learn_solution(popper_settings)
prog = list(prog) for rule in prog: rule_string = popper.util.format_rule(rule)[:-1] janus.query_once(f'assert(({rule_string})), fail')
Use janus.query to see which examples match the rule...
It appears that some information is not reset between loop iterations. For instance, the examples appear to be accumulating. Is there a way to reset the examples that are stored in the Prolog session, or, better yet, reset everything? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
I'm trying to run Popper from Python in a loop like this:
It appears that some information is not reset between loop iterations. For instance, the examples appear to be accumulating. Is there a way to reset the examples that are stored in the Prolog session, or, better yet, reset everything?