public Pair < String , VarTensor > decode ( FgModel model , LogLinearExample llex ) { LFgExample ex = getFgExample ( llex ) ; MbrDecoderPrm prm = new MbrDecoderPrm ( ) ; prm . infFactory = getBpPrm ( ) ; MbrDecoder decoder = new MbrDecoder ( prm ) ; decoder . decode ( model , ex ) ; List < VarTensor > marginals = decoder . getVarMarginals ( ) ; VarConfig vc = decoder . getMbrVarConfig ( ) ; String stateName = vc . getStateName ( ex . getFactorGraph ( ) . getVar ( 0 ) ) ; if ( marginals . size ( ) != 1 ) { throw new IllegalStateException ( "Example is not from a LogLinearData factory" ) ; } return new Pair < String , VarTensor > ( stateName , marginals . get ( 0 ) ) ; }
Decodes a single example .