Can Popper count?
Closed this issue · 3 comments
Would it be possible to let popper count?
Specifically, I am trying to do a sentiment analysis using popper on a twitter dataset. I am using a word list, which defines some words as positive or negative words as background logic. I am trying to let popper find a rule which might look like this:
f(A):- pos_count(A, 10)
Popper does find the rule, if I am including a statement like this:
ten(10)
Then it creates a rule in the following format:
f(A):- pos_count(A,B), ten(B)
It is just tedious to define all numbers. Is there a better way to do it?
Popper currently requires to define possible numbers in the bk and bias files.
MagicPopper (https://github.com/celinehocquette/magicpopper) is an extension of Popper which can learn programs of the form f(A):- pos_count(A,10) without needing to define all numbers. You simply need to declare that some predicates can have constant symbols as argument in the bias file.
However, MagicPopper is based on an older version of Popper. We hope to merge MagicPopper into this repository soon to provide better performance.
How do you define possible numbers? I need number 1. I added one(1).
to both .bias
and .bk
files. Is that correct?
You can add the following to the bias file:
body_pred(one,1).
along with possibly types and / or directions:
type(one,(int,)).
direction(one,(out,)).
and the following to the bk file:
one(1).
Please check some examples, such as length.
Alternatively, if you have many numbers it may be preferable to define them as magic values using MagicPopper.