iitb.Model
Class FeatureGenImpl
java.lang.Object
  
iitb.Model.FeatureGenImpl
- All Implemented Interfaces: 
 - FeatureGenerator
 
- public class FeatureGenImpl
- extends java.lang.Object
- implements FeatureGenerator
   
The FeatureGenerator is an aggregator over all these different
 feature types. You can inherit from the FeatureGenImpl class and
 after calling one of the constructors that does not make a call to
 (addFeatures()) you can then implement your own addFeatures
 class. There you will typically add the EdgeFeatures feature first
 and then the rest.  So, for example if you wanted to add some
 parameter for each label (like a prior), you can create a new
 FeatureTypes class that will create as many featureids as the
 number of labels. You will have to create a new class that is
 derived from FeatureGenImpl and just have a different
 implementation of the addFeatures subroutine. The rest will be
 handled by the parent class.  
 This class  is responsible for converting the
 string-ids that the FeatureTypes assign to their features into
 distinct numbers. It has a inner class called FeatureMap that will
 make one pass over the training data and create the map of
 featurenames->integer id and as a side effect count the number of
 features.
- Author:
 
  - Sunita Sarawagi
 
 
| 
Constructor Summary | 
FeatureGenImpl(java.lang.String modelSpecs,
               int numLabels)
 
            | 
FeatureGenImpl(java.lang.String modelSpecs,
               int numLabels,
               boolean addFeatureNow)
 
            | 
 
 
| Methods inherited from class java.lang.Object | 
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
model
public Model model
FeatureGenImpl
public FeatureGenImpl(java.lang.String modelSpecs,
                      int numLabels)
               throws java.lang.Exception
FeatureGenImpl
public FeatureGenImpl(java.lang.String modelSpecs,
                      int numLabels,
                      boolean addFeatureNow)
               throws java.lang.Exception
addFeature
public void addFeature(FeatureTypes fType)
 
 
stateMappings
public void stateMappings(DataIter trainData)
                   throws java.lang.Exception
 
- Throws:
 java.lang.Exception
 
train
public void train(DataIter trainData)
           throws java.lang.Exception
 
- Throws:
 java.lang.Exception
 
startScanFeaturesAt
public void startScanFeaturesAt(DataSequence d,
                                int p)
- Specified by:
 startScanFeaturesAt in interface FeatureGenerator
 
 
hasNext
public boolean hasNext()
- Specified by:
 hasNext in interface FeatureGenerator
 
 
next
public Feature next()
- Specified by:
 next in interface FeatureGenerator
 
 
numFeatures
public int numFeatures()
- Description copied from interface: 
FeatureGenerator 
- The number of features has to be correctly set before train is called.
- Specified by:
 numFeatures in interface FeatureGenerator
 
 
 
numStates
public int numStates()
 
 
label
public int label(int stateNum)
 
 
mapStatesToLabels
public void mapStatesToLabels(DataSequence data)
 
 
read
public void read(java.lang.String fileName)
          throws java.io.IOException
 
- Throws:
 java.io.IOException
 
write
public void write(java.lang.String fileName)
           throws java.io.IOException
 
- Throws:
 java.io.IOException
 
Submit a bug or feature.