inference with two or more variables

54 views
Skip to first unread message

Joshua Cason

unread,
Mar 10, 2015, 5:32:40 PM3/10/15
to dis...@factorie.cs.umass.edu
Hi all,

I've come up with a model involving two labeled variable types. More concretely, the model connects two tokens to a label marking a semantic relation, and one "IsPredLabel" for each token of the pair to mark which is the semantic head. It's not immediately clear to me how to use the model since the input types for the training and inferring methods seem to be restricted to iterables of one variable type. I have also not yet been able to identify any > 1 labeled variable examples in the codebase - though I may have seen one and not recognized it admittedly.

If you've got some pointers or know of a good example class or object to look at, that would be awesome. Thanks!

Josh

Joshua Cason

unread,
Mar 10, 2015, 6:32:49 PM3/10/15
to dis...@factorie.cs.umass.edu
Or is this just necessarily a two step process? That would, I think, mean my model is incorrect since I have a template that unrolls factors between the two label types.

Joshua Cason

unread,
Mar 13, 2015, 2:58:34 PM3/13/15
to dis...@factorie.cs.umass.edu
Hi again,

Just to summarize my question, could somebody either tell me:

- that Factorie doesn't support learning/inferring on more than one variable type jointly (i.e., I was just mistaken that it did)
- Or, where an example of it is in the codebase?

Any help would be super appreciated. 

Josh

Joshua Cason

unread,
Mar 15, 2015, 5:06:06 PM3/15/15
to dis...@factorie.cs.umass.edu
I tried just dumping all the labels in an iterable together. It compiled and ran without any complaints, and the results seemed sensible. The compiler inferred the following type:

ArrayBuffer[LabeledCategoricalVariable[_ >: String with Boolean]]

So if anybody else becomes curious about how to do this, you can try that. If someone has a better idea, feel free to add.

Josh

Joshua Cason

unread,
Mar 25, 2015, 4:18:18 PM3/25/15
to dis...@factorie.cs.umass.edu
Looks like I was conflating more than one idea here, learning and inferring on more than one label type and joint inference. As far as my question goes though, I'm pretty sure that my suggestion will work - unless you override the unroll method. addFactors calls all the unrollN methods after an isAssignableFrom check and as v.asInstanceOf[T], but unroll does not. So if you tag your labels using a super type as I suggest above to put them all into an ArrayBuffer, any factors from unroll will fail to be gathered. 

I noticed this because of an error with MPLP I commented on in another thread. If you are using MPLP, and the only factors you have for a variable are called using unroll, and you have more than one inference variable type, then you'll probably get an error when you infer using MPLP.

Anyway, just thought I'd share my findings :)

Josh

Joshua Cason

unread,
Apr 21, 2015, 3:38:43 PM4/21/15
to dis...@factorie.cs.umass.edu
Sorry about this running conversation with myself, but perhaps this will benefit someone down the road.

I just wanted to point out that using a super type with unroll is ok if you just check the type in your definition with a case statement, and I believe there are several examples of that in the code base. VarArgsDemo.scala for instance.

Josh
Reply all
Reply to author
Forward
0 new messages