|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.maxent.iis.Feature
This class is used as a base class for TaggerFeature for the tagging problem and for BinaryFeature for the general problem with binary features.
Field Summary | |
protected HashMap |
hashValues
|
int[] |
indexedValues
This will contain the (x,y) pairs for which the feature is non-zero in case it is sparse. |
double |
sum
|
double[] |
valuesI
These are the non-zero values we want to keep for the points in indexedValues. |
Constructor Summary | |
Feature()
|
|
Feature(Experiments e,
double[] vals)
This is if we are given an array of double with a value for each training sample in the order of their occurence. |
|
Feature(Experiments e,
double[][] vals)
|
|
Feature(Experiments e,
int[] indexes,
double[] vals)
|
Method Summary | |
double |
ftiled()
|
double |
getVal(int index)
Get the value at the index-ed non zero value pair (x,y) |
double |
getVal(int x,
int y)
This is rarely used because it is slower and requires initHashVals() to be called beforehand to initiallize the hashValues |
int |
getX(int index)
|
int |
getY(int index)
|
void |
initHashVals()
Creates a hashmap with keys pairs (x,y) and values the value of the function at the pair; required for use of getVal(x,y) |
boolean |
isEmpty()
|
int |
len()
|
void |
print()
Prints out the points where the feature is non-zero and the values at these points. |
void |
print(PrintStream pf)
|
void |
read(InDataStreamFile inf)
|
void |
save(OutDataStreamFile oF)
|
void |
setSum()
|
double |
sumValues()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int[] indexedValues
public double[] valuesI
protected HashMap hashValues
public double sum
Constructor Detail |
public Feature()
public Feature(Experiments e, double[] vals)
public Feature(Experiments e, double[][] vals)
vals
- a value for each (x,y) pairpublic Feature(Experiments e, int[] indexes, double[] vals)
indexes
- The pairs (x,y) for which the feature is non-zero. They are coded as x*ySize+yvals
- The values at these points.Method Detail |
public void print()
public void print(PrintStream pf)
public double getVal(int index)
public void setSum()
public double sumValues()
public void save(OutDataStreamFile oF)
public void read(InDataStreamFile inf)
public int len()
public boolean isEmpty()
public int getX(int index)
public int getY(int index)
public double getVal(int x, int y)
public void initHashVals()
public double ftiled()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |