edu.stanford.nlp.classify
Class GeneralizedExpectationObjectiveFunction<L,F>

java.lang.Object
  extended by edu.stanford.nlp.optimization.AbstractCachingDiffFunction
      extended by edu.stanford.nlp.classify.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. 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)

Field Summary
protected  int numClasses
           
protected  int numFeatures
           
 
Fields inherited from class edu.stanford.nlp.optimization.AbstractCachingDiffFunction
derivative, value
 
Constructor Summary
GeneralizedExpectationObjectiveFunction(GeneralDataset<L,F> labeledDataset, java.util.List<? extends Datum<L,F>> unlabeledDataList, java.util.List<F> geFeatures)
           
 
Method Summary
protected  void calculate(double[] x)
          Calculate the value at x and the derivative and save them in the respective fields
 int domainDimension()
          Returns the number of dimensions in the function's domain
protected  int indexOf(int f, int c)
           
 double[][] to2D(double[] x)
           
 
Methods inherited from class edu.stanford.nlp.optimization.AbstractCachingDiffFunction
clearCache, copy, derivativeAt, initial, lastValue, setValue, valueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numFeatures

protected int numFeatures

numClasses

protected int numClasses
Constructor Detail

GeneralizedExpectationObjectiveFunction

public GeneralizedExpectationObjectiveFunction(GeneralDataset<L,F> labeledDataset,
                                               java.util.List<? extends Datum<L,F>> unlabeledDataList,
                                               java.util.List<F> geFeatures)
Method Detail

domainDimension

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

Specified by:
domainDimension in interface Function
Specified by:
domainDimension in class AbstractCachingDiffFunction
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


Stanford NLP Group