edu.stanford.nlp.maxent.iis
Class BinaryFeature
java.lang.Object
|
+--edu.stanford.nlp.maxent.iis.Feature
|
+--edu.stanford.nlp.maxent.iis.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)
Method Summary |
double |
ftiled()
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinaryFeature
public BinaryFeature()
BinaryFeature
public BinaryFeature(Experiments e,
double[] vals)
- 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)
BinaryFeature
public BinaryFeature(Experiments domain,
double[][] vals)
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 Idy
- the outcome Id
- Returns:
- the value of the feature at the point (x,y)
ftiled
public double ftiled()
- Overrides:
ftiled
in class Feature
- Returns:
- the empirical expectation of the feature
Stanford NLP Group