Class SelfTransitionGEConstraint
- java.lang.Object
-
- cc.mallet.fst.semi_supervised.constraints.SelfTransitionGEConstraint
-
- All Implemented Interfaces:
GEConstraint
public class SelfTransitionGEConstraint extends java.lang.Object implements GEConstraint
GE Constraint on the probability of self-transitions in the FST.- Author:
- Gregory Druck
-
-
Constructor Summary
Constructors Constructor Description SelfTransitionGEConstraint(double selfTransProb, double weight)
-
Method Summary
All Methods Instance Methods Concrete 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 fv, int ip, int si1, int si2)
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 fv)
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
-
copy
public GEConstraint copy()
Description copied from interface:GEConstraint
This is used in multi-threading.- Specified by:
copy
in interfaceGEConstraint
- Returns:
- A copy of the GEConstraint.
-
isOneStateConstraint
public boolean isOneStateConstraint()
- Specified by:
isOneStateConstraint
in interfaceGEConstraint
- Returns:
- true if constraint feature only considers one state
-
setStateLabelMap
public void setStateLabelMap(StateLabelMap map)
Description copied from interface:GEConstraint
Sets that map between the state indices and label indices.- Specified by:
setStateLabelMap
in interfaceGEConstraint
- Parameters:
map
- StateLabelMap
-
preProcess
public void preProcess(FeatureVector fv)
Description copied from interface:GEConstraint
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 interfaceGEConstraint
- Parameters:
fv
- FeatureVector input
-
preProcess
public java.util.BitSet preProcess(InstanceList data)
- Specified by:
preProcess
in interfaceGEConstraint
- 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.
-
getCompositeConstraintFeatureValue
public double getCompositeConstraintFeatureValue(FeatureVector fv, int ip, int si1, int si2)
Description copied from interface:GEConstraint
Computes the composite constraint feature value (over all constraint features) for FeatureVector fv and a transition from state li1 to li2.- Specified by:
getCompositeConstraintFeatureValue
in interfaceGEConstraint
- Parameters:
fv
- FeatureVector on transitionip
- Position of input in sequencesi1
- Source state index for transitionsi2
- Destination state index for transition- Returns:
- Constraint feature value
-
getValue
public double getValue()
Description copied from interface:GEConstraint
Returns the total constraint value.- Specified by:
getValue
in interfaceGEConstraint
- Returns:
- Constraint value
-
zeroExpectations
public void zeroExpectations()
Description copied from interface:GEConstraint
Zero expectation values. Called before re-computing gradient.- Specified by:
zeroExpectations
in interfaceGEConstraint
-
computeExpectations
public void computeExpectations(java.util.ArrayList<SumLattice> lattices)
Description copied from interface:GEConstraint
Compute expectations using cached lattices.- Specified by:
computeExpectations
in interfaceGEConstraint
- Parameters:
lattices
- Cached SumLattices
-
-