cc.mallet.classify.constraints.ge
Interface MaxEntGEConstraint

All Known Implementing Classes:
MaxEntFLGEConstraints, MaxEntKLFLGEConstraints, MaxEntL2FLGEConstraints, MaxEntRangeL2FLGEConstraints

public interface MaxEntGEConstraint

Interface for expectation constraints for use with Generalized Expectation (GE).

Author:
Gregory Druck

Method Summary
 void computeExpectations(FeatureVector fv, double[] dist, double weight)
          Compute expectations using provided distribution over labels.
 double getCompositeConstraintFeatureValue(FeatureVector input, int label)
          Computes the composite constraint feature value (over all constraint features) for FeatureVector fv and label label.
 double getValue()
          Returns the total constraint value.
 void preProcess(FeatureVector input)
          Gives the constraint the option to do some caching using only the FeatureVector.
 java.util.BitSet preProcess(InstanceList data)
           
 void zeroExpectations()
          Zero expectation values.
 

Method Detail

getCompositeConstraintFeatureValue

double getCompositeConstraintFeatureValue(FeatureVector input,
                                          int label)
Computes the composite constraint feature value (over all constraint features) for FeatureVector fv and label label.

Parameters:
input - input FeatureVector
label - output label index
Returns:
Constraint feature value

getValue

double getValue()
Returns the total constraint value.

Returns:
Constraint value

computeExpectations

void computeExpectations(FeatureVector fv,
                         double[] dist,
                         double weight)
Compute expectations using provided distribution over labels.

Parameters:
fv - FeatureVector
dist - Distribution over labels
data - Unlabeled data

zeroExpectations

void zeroExpectations()
Zero expectation values. Called before re-computing gradient.


preProcess

java.util.BitSet preProcess(InstanceList data)
Parameters:
data - Unlabeled data
Returns:
Returns a bitset of the size of the data, with the bit set if a constraint feature fires in that instance.

preProcess

void preProcess(FeatureVector input)
Gives the constraint the option to do some caching using only the FeatureVector. For example, the constrained input features could be cached.

Parameters:
input - FeatureVector input