starling-lab / BoostSRL

BoostSRL: "Boosting for Statistical Relational Learning." A gradient-boosting based approach for learning different types of SRL models.
https://starling.utdallas.edu
GNU General Public License v3.0
32 stars 21 forks source link

Constant mode on the head of a rule #22

Open brenowca opened 6 years ago

brenowca commented 6 years ago

Hi, I have this directive in my bk file:

mode: frame_element_anno(+sent,-const,-const,#fe,#frame).

And this literal is my goal. The rules that I get from the package does not bind fe and frame to constants. Is there something I am missing?

hayesall commented 6 years ago

I'm guessing you set -target frame_element_anno?

I see one potential problem in setting - values in the target: the software will have to search over all other (possibly irrelevant) groundings of those values in order to learn the predicate. If you look at the data sets on our website, target predicates always use +.

It's difficult to say from the information you provided why fe and frame are not being bound. Maybe start by checking that your positive, negative, and facts files to make sure they are structured correctly. Is it possible to share the learned trees or the rest of the modes in the bk file?

mayukhdas commented 6 years ago

It is a similar concern related to a previous issue https://github.com/starling-lab/BoostSRL/issues/21.

We set all the terms in the target as + since you essentially need the head to be instantiated with the example, and then the Clause learner will search for increasingly larger clauses with terms bound to the head.

brenowca commented 6 years ago

Thank you very much for the fast replys @batflyer, and @mayukhdas :)

It is a similar concern related to a previous issue #21.

Yep, it is a related question, but I thought this one was specific enough to get its own thread. I might be wrong.

We set all the terms in the target as + since you essentially need the head to be instantiated with the example, and then the Clause learner will search for increasingly larger clauses with terms bound to the head.

Gotcha, but does it makes sense to have # in the head of the rule? I would like to learn rules that some of the terms in the head are constants.

I'm guessing you set -target frame_element_anno?

Yes, something like this:

java -jar BoostSRL.jar -l -combine -train train_small/ -target frame_element_anno -trees 10

I see one potential problem in setting - values in the target: the software will have to search over all other (possibly irrelevant) groundings of those values in order to learn the predicate. If you look at the data sets on our website, target predicates always use +.

That is curious, but it makes sense.

It's difficult to say from the information you provided why fe and frame are not being bound. Maybe start by checking that your positive, negative, and facts files to make sure they are structured correctly.

Already doing it, I will keep you updated :)

Is it possible to share the learned trees or the rest of the modes in the bk file?

Sure :) bk:

//Parameters
setParam: maxTreeDepth=3
setParam: nodeSize=3.
setParam: numOfClauses=8.

//  *********
//  * Modes *
//  *********

// mode: frame(+val).
mode: frame_element(+fe,+frame).
// mode: frame_element(-fe,+frame).

mode: frame_anno(+sent,-const,-const,+frame).
mode: frame_element_anno(+sent,-const,-const,#fe,#frame).

mode: path2fe(+sent, +const, +const, +frame, +fe).
mode: sub_sentence(+sent,-const,-const).

bridger: sub_sentence/3.
rodrigoazs commented 6 years ago

Hi @brenocarvalho

Do you actually want to learn clauses for specific constants on the head of a rule? As the example below from SLIPCOVER:

rating(A,rating_1):0.335616 :-
  diff(A,B),
  diff(A,diff_2).

rating(A,rating_1):0.179213 :-
  diff(A,B),
  b_registration(A,C),
  b_registration(A,D).
...

rating(A,rating_2):0.433115 :-
  diff(A,B),
  diff(A,diff_1).

rating(A,rating_2):0.500469 :-
  diff(A,B).
...

If that is what you want to do, perhaps you can achieve that by learning trees from examples of each constant of the head of rule. Taking the example above, you will learn trees for the target rating(A,B) from positive and negative examples that have B as constant rating_1 and will do the same for constant rating_2. This way you will make sure you are learning clauses with head rating(A,rating_1) and rating(A,rating_2).