Interface GEConstraint
-
- All Known Implementing Classes:
OneLabelGEConstraints,OneLabelKLGEConstraints,OneLabelL2GEConstraints,OneLabelL2RangeGEConstraints,SelfTransitionGEConstraint,TwoLabelGEConstraints,TwoLabelKLGEConstraints,TwoLabelL2GEConstraints
public interface GEConstraintInterface for GE constraint that considers either one or two states.- Author:
- Gregory Druck
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcomputeExpectations(java.util.ArrayList<SumLattice> lattices)Compute expectations using cached lattices.GEConstraintcopy()This is used in multi-threading.doublegetCompositeConstraintFeatureValue(FeatureVector input, int inputPosition, int srcIndex, int destIndex)Computes the composite constraint feature value (over all constraint features) for FeatureVector fv and a transition from state li1 to li2.doublegetValue()Returns the total constraint value.booleanisOneStateConstraint()voidpreProcess(FeatureVector input)Gives the constraint the option to do some caching using only the FeatureVector.java.util.BitSetpreProcess(InstanceList data)voidsetStateLabelMap(StateLabelMap map)Sets that map between the state indices and label indices.voidzeroExpectations()Zero expectation values.
-
-
-
Method Detail
-
getCompositeConstraintFeatureValue
double getCompositeConstraintFeatureValue(FeatureVector input, int inputPosition, int srcIndex, int destIndex)
Computes the composite constraint feature value (over all constraint features) for FeatureVector fv and a transition from state li1 to li2.- Parameters:
input- FeatureVector on transitioninputPosition- Position of input in sequencesrcIndex- Source state index for transitiondestIndex- Destination state index for transition- Returns:
- Constraint feature value
-
getValue
double getValue()
Returns the total constraint value.- Returns:
- Constraint value
-
computeExpectations
void computeExpectations(java.util.ArrayList<SumLattice> lattices)
Compute expectations using cached lattices.- Parameters:
lattices- Cached SumLatticesdata- Unlabeled data
-
zeroExpectations
void zeroExpectations()
Zero expectation values. Called before re-computing gradient.
-
setStateLabelMap
void setStateLabelMap(StateLabelMap map)
Sets that map between the state indices and label indices.- Parameters:
map- StateLabelMap
-
copy
GEConstraint copy()
This is used in multi-threading.- Returns:
- A copy of the GEConstraint.
-
isOneStateConstraint
boolean isOneStateConstraint()
- Returns:
- true if constraint feature only considers one state
-
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
-
-