cc.mallet.classify.constraints.pr
Class MaxEntL2FLPRConstraints

java.lang.Object
  extended by cc.mallet.classify.constraints.pr.MaxEntFLPRConstraints
      extended by cc.mallet.classify.constraints.pr.MaxEntL2FLPRConstraints
All Implemented Interfaces:
MaxEntPRConstraint

public class MaxEntL2FLPRConstraints
extends MaxEntFLPRConstraints

Expectation constraint for use with Posterior Regularization (PR). Penalizes L_2^2 difference from target distribution.

Author:
Gregory Druck

Nested Class Summary
protected  class MaxEntL2FLPRConstraints.MaxEntL2FLPRConstraint
           
 
Nested classes/interfaces inherited from class cc.mallet.classify.constraints.pr.MaxEntFLPRConstraints
MaxEntFLPRConstraints.MaxEntFLPRConstraint
 
Field Summary
 
Fields inherited from class cc.mallet.classify.constraints.pr.MaxEntFLPRConstraints
constraints, indexCache, numFeatures, numLabels, useValues, valueCache
 
Constructor Summary
MaxEntL2FLPRConstraints(int numFeatures, int numLabels, boolean useValues, boolean normalize)
           
 
Method Summary
 void addConstraint(int fi, double[] ex, double weight)
           
 double getAuxiliaryValueContribution(double[] parameters)
           
 double getCompleteValueContribution()
           
 void getGradient(double[] parameters, double[] gradient)
           
 double getScore(FeatureVector input, int label, double[] parameters)
           
 int numDimensions()
           
 
Methods inherited from class cc.mallet.classify.constraints.pr.MaxEntFLPRConstraints
incrementExpectations, preProcess, preProcess, zeroExpectations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaxEntL2FLPRConstraints

public MaxEntL2FLPRConstraints(int numFeatures,
                               int numLabels,
                               boolean useValues,
                               boolean normalize)
Method Detail

addConstraint

public void addConstraint(int fi,
                          double[] ex,
                          double weight)
Specified by:
addConstraint in class MaxEntFLPRConstraints

numDimensions

public int numDimensions()

getAuxiliaryValueContribution

public double getAuxiliaryValueContribution(double[] parameters)

getGradient

public void getGradient(double[] parameters,
                        double[] gradient)

getCompleteValueContribution

public double getCompleteValueContribution()

getScore

public double getScore(FeatureVector input,
                       int label,
                       double[] parameters)