edu.stanford.nlp.ie.crf

## Class FactorTable

• public class FactorTable
extends 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 Detail

• #### FactorTable

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

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

• #### hasNaN

public boolean hasNaN()
• #### toProbString

public String toProbString()
• #### toNonLogString

public String toNonLogString()
• #### toString

public <L> String toString(Index<L> classIndex)
• #### 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)

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(String[] args)

Stanford NLP Group