edu.stanford.nlp.ie.crf

## Class FactorTable

• java.lang.Object
• edu.stanford.nlp.ie.crf.FactorTable

• ```public class FactorTable
extends java.lang.Object```
Stores a factor table as a one dimensional array of doubles. This class supports a restricted form of factor table where each variable has the same set of values, but supports cliques of arbitrary size.
Author:
Jenny Finkel
• ### Constructor Summary

Constructors
Constructor and Description
`FactorTable(FactorTable t)`
```FactorTable(int numClasses, int windowSize)```
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double` ```conditionalLogProbGivenFirst(int given, int[] of)```
Computes the probability of the sequence OF being at the end of the table given that the first tag in table is GIVEN.
`double` ```conditionalLogProbGivenNext(int[] given, int of)```
Computes the probability of the tag OF being at the beginning of the table given that the tag sequence GIVEN is at the end of the table.
`double` ```conditionalLogProbGivenPrevious(int[] given, int of)```
Computes the probability of the tag OF being at the end of the table given that the previous tag sequence in table is GIVEN.
`double[]` `conditionalLogProbsGivenPrevious(int[] given)`
Computes the probabilities of the tag at the end of the table given that the previous tag sequence in table is GIVEN.
`void` `divideBy(FactorTable other)`
`double` `getValue(int index)`
`double` `getValue(int[] label)`
`boolean` `hasNaN()`
`void` ```incrementValue(int[] label, double value)```
`void` ```incrementValue(int index, double value)```
`void` ```logIncrementValue(int[] label, double value)```
`double` `logProb(int[] label)`
`double` `logProbEnd(int label)`
`double` `logProbEnd(int[] labels)`
`double` `logProbFront(int label)`
`double` `logProbFront(int[] label)`
`static void` `main(java.lang.String[] args)`
`void` `multiplyInEnd(FactorTable other)`
`void` `multiplyInFront(FactorTable other)`
`int` `numClasses()`
`double` `prob(int[] label)`
`void` ```setValue(int[] label, double value)```
`void` ```setValue(int index, double value)```
`int` `size()`
`FactorTable` `sumOutEnd()`
`FactorTable` `sumOutFront()`
`int[]` `toArray(int index)`
`java.lang.String` `toNonLogString()`
`java.lang.String` `toProbString()`
`java.lang.String` `toString()`
`<L> java.lang.String` `toString(Index<L> classIndex)`
`double` `totalMass()`
`double` ```unnormalizedConditionalLogProbGivenFirst(int given, int[] of)```
Computes the probability of the sequence OF being at the end of the table given that the first tag in table is GIVEN.
`double` `unnormalizedLogProb(int[] label)`
Returns a single clique potential.
`double` ```unnormalizedLogProb(int front, int[] end, int cutoff)```
Returns a single clique potential.
`double` `unnormalizedLogProbEnd(int label)`
`double` `unnormalizedLogProbEnd(int[] labels)`
`double` `unnormalizedLogProbFront(int label)`
`double` `unnormalizedLogProbFront(int[] labels)`
`int` `windowSize()`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### FactorTable

```public FactorTable(int numClasses,
int windowSize)```
• #### FactorTable

`public FactorTable(FactorTable t)`
• ### Method Detail

• #### hasNaN

`public boolean hasNaN()`
• #### toProbString

`public java.lang.String toProbString()`
• #### toNonLogString

`public java.lang.String toNonLogString()`
• #### toString

`public <L> java.lang.String toString(Index<L> classIndex)`
• #### toString

`public java.lang.String toString()`
Overrides:
`toString` in class `java.lang.Object`
• #### toArray

`public int[] toArray(int index)`
• #### windowSize

`public int windowSize()`
• #### numClasses

`public int numClasses()`
• #### size

`public int size()`
• #### totalMass

`public double totalMass()`
• #### unnormalizedLogProb

`public double unnormalizedLogProb(int[] label)`
Returns a single clique potential.
• #### unnormalizedLogProb

```public double unnormalizedLogProb(int front,
int[] end,
int cutoff)```
Returns a single clique potential.
• #### logProb

`public double logProb(int[] label)`
• #### prob

`public double prob(int[] label)`
• #### conditionalLogProbGivenPrevious

```public double conditionalLogProbGivenPrevious(int[] given,
int of)```
Computes the probability of the tag OF being at the end of the table given that the previous tag sequence in table is GIVEN. given is at the beginning, of is at the end.
Returns:
the probability of the tag OF being at the end of the table
• #### conditionalLogProbsGivenPrevious

`public double[] conditionalLogProbsGivenPrevious(int[] given)`
Computes the probabilities of the tag at the end of the table given that the previous tag sequence in table is GIVEN. given is at the beginning, position in question is at the end
Returns:
the probabilities of the tag at the end of the table
• #### conditionalLogProbGivenFirst

```public double conditionalLogProbGivenFirst(int given,
int[] of)```
Computes the probability of the sequence OF being at the end of the table given that the first tag in table is GIVEN. given is at the beginning, of is at the end
Returns:
the probability of the sequence of being at the end of the table
• #### unnormalizedConditionalLogProbGivenFirst

```public double unnormalizedConditionalLogProbGivenFirst(int given,
int[] of)```
Computes the probability of the sequence OF being at the end of the table given that the first tag in table is GIVEN. given is at the beginning, of is at the end.
Returns:
the probability of the sequence of being at the end of the table
• #### conditionalLogProbGivenNext

```public double conditionalLogProbGivenNext(int[] given,
int of)```
Computes the probability of the tag OF being at the beginning of the table given that the tag sequence GIVEN is at the end of the table. given is at the end, of is at the beginning
Returns:
the probability of the tag of being at the beginning of the table
• #### unnormalizedLogProbFront

`public double unnormalizedLogProbFront(int[] labels)`
• #### logProbFront

`public double logProbFront(int[] label)`
• #### unnormalizedLogProbFront

`public double unnormalizedLogProbFront(int label)`
• #### logProbFront

`public double logProbFront(int label)`
• #### unnormalizedLogProbEnd

`public double unnormalizedLogProbEnd(int[] labels)`
• #### logProbEnd

`public double logProbEnd(int[] labels)`
• #### unnormalizedLogProbEnd

`public double unnormalizedLogProbEnd(int label)`
• #### logProbEnd

`public double logProbEnd(int label)`
• #### getValue

`public double getValue(int index)`
• #### getValue

`public double getValue(int[] label)`
• #### setValue

```public void setValue(int index,
double value)```
• #### setValue

```public void setValue(int[] label,
double value)```
• #### incrementValue

```public void incrementValue(int[] label,
double value)```
• #### incrementValue

```public void incrementValue(int index,
double value)```

```public void logIncrementValue(int[] label,
double value)```
• #### multiplyInFront

`public void multiplyInFront(FactorTable other)`
• #### multiplyInEnd

`public void multiplyInEnd(FactorTable other)`
• #### sumOutEnd

`public FactorTable sumOutEnd()`
• #### sumOutFront

`public FactorTable sumOutFront()`
• #### divideBy

`public void divideBy(FactorTable other)`
• #### main

`public static void main(java.lang.String[] args)`

Stanford NLP Group