public double unnormalizedConditionalLogProbGivenFirst ( int given , int [ ] of ) { if ( of . length != windowSize - 1 ) { throw new IllegalArgumentException ( "unnormalizedConditionalLogProbGivenFirst requires of one less than clique size (" + windowSize + ") but was " + Arrays . toString ( of ) ) ; } // compute P(given, of) int [ ] labels = new int [ windowSize ] ; labels [ 0 ] = given ; System . arraycopy ( of , 0 , labels , 1 , windowSize - 1 ) ; // double probAll = logProb(labels); double probAll = unnormalizedLogProb ( labels ) ; // compute P(given) // double probGiven = logProbFront(given); // double probGiven = unnormalizedLogProbFront(given); // compute P(given, of) / P(given) // return probAll - probGiven; return probAll ; }
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 .