code: public static FeatureVector getObservedFeatureCounts(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 fgLat = getFgLat(ex.getFactorGraph(), ex.getGoldConfig());
              fgLat.updateFromModel(model);
              FgInferencer infLat = infFactory.getInferencer(fgLat);
              infLat.run();
              addExpectedPartials(fgLat, infLat, 1.0 * ex.getWeight(), feats);
          }
          double[] f = new double[model.getNumParams()];
          feats.updateDoublesFromModel(f);
          return new FeatureVector(f);
      }
docs: Gets the "observed" feature counts.