public Factor addBinaryFactor ( int a , int b , BiFunction < Integer , Integer , ConcatVector > featurizer ) { int [ ] variableDims = getVariableSizes ( ) ; assert a < variableDims . length ; assert b < variableDims . length ; return addFactor ( new int [ ] { a , b } , new int [ ] { variableDims [ a ] , variableDims [ b ] } , assignment -> featurizer . apply ( assignment [ 0 ] , assignment [ 1 ] ) ) ; }
A simple helper function for defining a binary factor . That is a factor between two variables in the graphical model .