cc.mallet.classify.constraints.pr
Class MaxEntFLPRConstraints
java.lang.Object
cc.mallet.classify.constraints.pr.MaxEntFLPRConstraints
- All Implemented Interfaces:
- MaxEntPRConstraint
- Direct Known Subclasses:
- MaxEntL2FLPRConstraints
public abstract class MaxEntFLPRConstraints
- extends java.lang.Object
- implements MaxEntPRConstraint
Abstract expectation constraint for use with Posterior Regularization (PR).
- Author:
- Gregory Druck
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
useValues
protected boolean useValues
numFeatures
protected int numFeatures
numLabels
protected int numLabels
constraints
protected gnu.trove.TIntObjectHashMap<MaxEntFLPRConstraints.MaxEntFLPRConstraint> constraints
indexCache
protected gnu.trove.TIntArrayList indexCache
valueCache
protected gnu.trove.TDoubleArrayList valueCache
MaxEntFLPRConstraints
public MaxEntFLPRConstraints(int numFeatures,
int numLabels,
boolean useValues)
addConstraint
public abstract void addConstraint(int fi,
double[] ex,
double weight)
incrementExpectations
public void incrementExpectations(FeatureVector input,
double[] dist,
double weight)
- Specified by:
incrementExpectations
in interface MaxEntPRConstraint
zeroExpectations
public void zeroExpectations()
- Description copied from interface:
MaxEntPRConstraint
- Zero expectation values. Called before re-computing gradient.
- Specified by:
zeroExpectations
in interface MaxEntPRConstraint
preProcess
public java.util.BitSet preProcess(InstanceList data)
- Specified by:
preProcess
in interface MaxEntPRConstraint
- 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
public void preProcess(FeatureVector input)
- Description copied from interface:
MaxEntPRConstraint
- Gives the constraint the option to do some caching
using only the FeatureVector. For example, the
constrained input features could be cached.
- Specified by:
preProcess
in interface MaxEntPRConstraint
- Parameters:
input
- FeatureVector input