edu.stanford.nlp.ie.crf
Class FactorTable

java.lang.Object
  extended by edu.stanford.nlp.ie.crf.FactorTable

public class FactorTable
extends Object

Stores a factor table as a one dimensional array of doubles.

Author:
Jenny Finkel

Constructor Summary
FactorTable(int numClasses, int windowSize)
           
 
Method Summary
 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.
 boolean containsNaN()
           
 void divideBy(FactorTable other)
           
 double getValue(int[] label)
           
 void incrementValue(int[] label, 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(String[] args)
           
 void multiplyInEnd(FactorTable other)
           
 void multiplyInFront(FactorTable other)
           
 int numClasses()
           
 double prob(int[] label)
           
 void setValue(int[] label, double value)
           
 FactorTable sumOutEnd()
           
 FactorTable sumOutFront()
           
 String toProbString()
           
 String toString()
           
 String toString(Index 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)
           
 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)
Method Detail

containsNaN

public boolean containsNaN()

toProbString

public String toProbString()

toString

public String toString(Index classIndex)

toString

public String toString()
Overrides:
toString in class Object

windowSize

public int windowSize()

numClasses

public int numClasses()

totalMass

public double totalMass()

unnormalizedLogProb

public double unnormalizedLogProb(int[] label)

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 begining, of is at the end

Parameters:
given -
of -
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 begining, position in question is at the end

Parameters:
given -
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 begining, of is at the end

Parameters:
given -
of -
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 begining, of is at the end

Parameters:
given -
of -
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 begining

Parameters:
given -
of -
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[] label)

setValue

public void setValue(int[] label,
                     double value)

incrementValue

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

logIncrementValue

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


Stanford NLP Group