edu.stanford.nlp.maxent
Class BinaryFeature

java.lang.Object
  extended by edu.stanford.nlp.maxent.Feature
      extended by edu.stanford.nlp.maxent.BinaryFeature

public class BinaryFeature
extends Feature

This is used when only binary features are needed. We don't need to keep the array of values valuesI any more (unlike the parent class Feature)


Field Summary
 
Fields inherited from class edu.stanford.nlp.maxent.Feature
hashValues, indexedValues, instanceIndex, sum, valuesI
 
Constructor Summary
BinaryFeature()
           
BinaryFeature(Experiments domain, double[][] vals, Index instanceIndex)
           
BinaryFeature(Experiments e, double[] vals, Index instanceIndex)
           
BinaryFeature(Experiments e, int[] indVals, Index instanceIndex)
           
 
Method Summary
 void getIndexed()
          Convert the setValues into an array of indexes of non-zero pairs indexedValues.
 double getVal(int index)
          Get the value at the index-ed non zero value pair (x,y)
 double getVal(int x, int y)
          This does sequential search in indexedValues.
 void getValues()
           
 boolean isEmpty()
           
 void print()
          Print put the pairs for which the feature is true
 
Methods inherited from class edu.stanford.nlp.maxent.Feature
ftilde, getX, getY, initHashVals, len, print, read, save, setSum, setValue, sumValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryFeature

public BinaryFeature()

BinaryFeature

public BinaryFeature(Experiments e,
                     double[] vals,
                     Index instanceIndex)
Parameters:
vals - will have length equal to the number of training samples (x,y) vals contains only 0s and 1s

BinaryFeature

public BinaryFeature(Experiments e,
                     int[] indVals,
                     Index instanceIndex)

BinaryFeature

public BinaryFeature(Experiments domain,
                     double[][] vals,
                     Index instanceIndex)
Method Detail

isEmpty

public boolean isEmpty()
Overrides:
isEmpty in class Feature
Returns:
true if the feature does not have a non-zero value at any data point

getValues

public void getValues()

getIndexed

public void getIndexed()
Convert the setValues into an array of indexes of non-zero pairs indexedValues.


print

public void print()
Print put the pairs for which the feature is true

Overrides:
print in class Feature

getVal

public double getVal(int index)
Description copied from class: Feature
Get the value at the index-ed non zero value pair (x,y)

Overrides:
getVal in class Feature

getVal

public double getVal(int x,
                     int y)
This does sequential search in indexedValues. It is slow.

Overrides:
getVal in class Feature
Parameters:
x - the history Id
y - the outcome Id
Returns:
the value of the feature at the point (x,y)


Stanford NLP Group