Get all positive and negative examples
Closed this issue · 2 comments
First of all, thank you for your great library.
I think the function "query" in the class Tester should return a list instead of a set cause the set only contains the first positive and negative example.
However, I don't get your result in both cases.
Test example
`settings = Settings(kbpath='examples/trains1')
prog, score, stats = learn_solution(settings)
if prog != None:
print_prog_score(prog, score)
else:
print('NO SOLUTION')
Before
class Tester():
def query(self, query, key):
return set(next(self.prolog.query(query))[key])
Num. pos examples: 1
Num. neg examples: 1
SOLUTION
Precision:1.00 Recall:1.00 TP:1 FN:0 TN:1 FP:0 Size:4
f(A):- has_car(A,C), has_load(C,B), three_load(B).
After
class Tester():
def query(self, query, key):
return list(next(self.prolog.query(query))[key])
Num. pos examples: 394
Num. neg examples: 606
SOLUTION
Precision:1.00 Recall:1.00 TP:394 FN:0 TN:606 FP:0 Size:4
f(A):- has_car(A,B), three_wheels(B), roof_closed(B).
I cannot replicate this bug. Can you confirm that you installed pyswip from the master branch with the command pip install git+https://github.com/yuce/pyswip@master#egg=pyswip
?
Can you also confirm the version of Prolog that you are using?
pip install git+https://github.com/yuce/pyswip@master#egg=pyswip
fixed the issue.
I used pip install pyswip
before and thought that this is the main branch, too.
Thank you very much for the fast reply.