Class GeneralizedExpectationObjectiveFunction<L,​F>

  • All Implemented Interfaces:
    DiffFunction, Function, HasInitial

    public class GeneralizedExpectationObjectiveFunction<L,​F>
    extends AbstractCachingDiffFunction
    Implementation of Generalized Expectation Objective function for an I.I.D. log-linear model. See Mann and McCallum, ACL 2008 for GE in CRFs. This code, however, is just for log-linear model IMPORTANT: the current implementation is only correct as long as the labeled features passed to GE are binary. However, other features are allowed to be real valued. The original paper also discusses GE only for binary features.
    Author:
    Ramesh Nallapati (nmramesh@cs.stanford.edu)
    • Constructor Detail

      • GeneralizedExpectationObjectiveFunction

        public GeneralizedExpectationObjectiveFunction​(GeneralDataset<L,​F> labeledDataset,
                                                       List<? extends Datum<L,​F>> unlabeledDataList,
                                                       List<F> geFeatures)
    • Method Detail

      • domainDimension

        public int domainDimension()
        Description copied from interface: Function
        Returns the number of dimensions in the function's domain
        Returns:
        the number of domain dimensions
      • indexOf

        protected int indexOf​(int f,
                              int c)
      • to2D

        public double[][] to2D​(double[] x)
      • calculate

        protected void calculate​(double[] x)
        Description copied from class: AbstractCachingDiffFunction
        Calculate the value at x and the derivative and save them in the respective fields.
        Specified by:
        calculate in class AbstractCachingDiffFunction
        Parameters:
        x - The point at which to calculate the function