Interface GEConstraint
-
- All Known Implementing Classes:
OneLabelGEConstraints
,OneLabelKLGEConstraints
,OneLabelL2GEConstraints
,OneLabelL2RangeGEConstraints
,SelfTransitionGEConstraint
,TwoLabelGEConstraints
,TwoLabelKLGEConstraints
,TwoLabelL2GEConstraints
public interface GEConstraint
Interface 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 void
computeExpectations(java.util.ArrayList<SumLattice> lattices)
Compute expectations using cached lattices.GEConstraint
copy()
This is used in multi-threading.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.double
getValue()
Returns the total constraint value.boolean
isOneStateConstraint()
void
preProcess(FeatureVector input)
Gives the constraint the option to do some caching using only the FeatureVector.java.util.BitSet
preProcess(InstanceList data)
void
setStateLabelMap(StateLabelMap map)
Sets that map between the state indices and label indices.void
zeroExpectations()
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
-
-