public static FeatureVector getExpectedFeatureCounts ( FgExampleList data , FgInferencerFactory infFactory , FgModel model , double [ ] params ) { model . updateModelFromDoubles ( params ) ; FgModel feats = model . getDenseCopy ( ) ; feats . zero ( ) ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { LFgExample ex = data . get ( i ) ; FactorGraph fgLatPred = ex . getFactorGraph ( ) ; fgLatPred . updateFromModel ( model ) ; FgInferencer infLatPred = infFactory . getInferencer ( fgLatPred ) ; infLatPred . run ( ) ; addExpectedPartials ( fgLatPred , infLatPred , 1.0 * ex . getWeight ( ) , feats ) ; } double [ ] f = new double [ model . getNumParams ( ) ] ; feats . updateDoublesFromModel ( f ) ; return new FeatureVector ( f ) ; }
Gets the expected feature counts .