Hi,
While using the MPLP inferencer I sometimes get the following error.
java.util.NoSuchElementException: key not found: MyLabel(labelValue)
I looked at the code, and (1) it seems like there could be a source of error there, but (2) this particular error doesn't make sense - it should have found the MyLabel.
The error is thrown from line 133 in MPLP.scala:
for (v <- variables) converged = converged && updateMessages(v.asInstanceOf[DiscreteVar], variableFactors(v))
It happens when v is looked up in variableFactors. variableFactors is created here:
for (f <- factors) {
for (v <- f.varyingVariables) {
val list = variableFactors.getOrElseUpdate(v, ArrayBuffer[MPLPFactor]())
list += f}}
And "varyingVariables" is created in MPLPFactor, in the same file on line 30:
val varyingVariables = thisVariables.filter(v => v.isInstanceOf[DiscreteVar]).map(_.asInstanceOf[DiscreteVar]).filter(varying.contains).toSet
So, in line 133 you're iterating over all the variables and looking up in a map created using a filtered subset of them. In theory that should be a problem. But, the key that threw my error shouldn't have been filtered out, so I'm still not sure what the cause of my error is.
Anyway, maybe I'm missing something and that code makes sense. Just thought I would point this out in case not.
One more clue is that I was running inference over my training labels after a training iteration to get training accuracy. A priori that doesn't seem like a problem, but it's worth mentioning. I haven't had this problem running inference on a dev set.
Josh
https://www.linkedin.com/in/joshcason
--
--
Factorie Discuss group.
To post, email: dis...@factorie.cs.umass.edu
To unsubscribe, email: discuss+u...@factorie.cs.umass.edu
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@factorie.cs.umass.edu.