public void setValue(int[] label, double value) { // try{ table[indexOf(label)] = value; // } catch (Exception e) { // e.printStackTrace(); // log.info("Table length: " + table.length + " indexOf(label): " // + indexOf(label)); // throw new ArrayIndexOutOfBoundsException(e.toString()); // // System.exit(1); // } }
public double getValue(int[] label) { return table[indexOf(label)]; }
public void incrementValue(int[] label, double value) { incrementValue(indexOf(label), value); }
public void logIncrementValue(int[] label, double value) { logIncrementValue(indexOf(label), value); }
/** * 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 * * @return the probabilities of the tag at the end of the table */ public double[] conditionalLogProbsGivenPrevious(int[] given) { if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbsGivenPrevious requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } double[] result = new double[numClasses]; for (int i = 0; i < numClasses; i++) { int index = indexOf(given, i); result[i] = table[index]; } ArrayMath.logNormalize(result); return result; }
/** * 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 * * @return the probability of the tag of being at the beginning of the table */ public double conditionalLogProbGivenNext(int[] given, int of) { if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenNext requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } int[] label = indicesEnd(given); double[] masses = new double[label.length]; for (int i = 0; i < masses.length; i++) { masses[i] = table[label[i]]; } double z = ArrayMath.logSum(masses); return table[indexOf(of, given)] - z; }
public void setValue(int[] label, double value) { // try{ table[indexOf(label)] = value; // } catch (Exception e) { // e.printStackTrace(); // log.info("Table length: " + table.length + " indexOf(label): " // + indexOf(label)); // throw new ArrayIndexOutOfBoundsException(e.toString()); // // System.exit(1); // } }
public void setValue(int[] label, double value) { // try{ table[indexOf(label)] = value; // } catch (Exception e) { // e.printStackTrace(); // System.err.println("Table length: " + table.length + " indexOf(label): " // + indexOf(label)); // throw new ArrayIndexOutOfBoundsException(e.toString()); // // System.exit(1); // } }
public void setValue(int[] label, double value) { // try{ table[indexOf(label)] = value; // } catch (Exception e) { // e.printStackTrace(); // System.err.println("Table length: " + table.length + " indexOf(label): " + indexOf(label)); // throw new ArrayIndexOutOfBoundsException(e.toString()); // // System.exit(1); // } }
public double getValue(int[] label) { return table[indexOf(label)]; }
public double getValue(int[] label) { return table[indexOf(label)]; }
public void incrementValue(int[] label, double value) { table[indexOf(label)] += value; }
public double getValue(int[] label) { return table[indexOf(label)]; }
public void logIncrementValue(int[] label, double value) { int index = indexOf(label); table[index] = SloppyMath.logAdd(table[index], value); }
public void logIncrementValue(int[] label, double value) { logIncrementValue(indexOf(label), value); }
public void incrementValue(int[] label, double value) { incrementValue(indexOf(label), value); }
public void incrementValue(int[] label, double value) { incrementValue(indexOf(label), value); }
public void logIncrementValue(int[] label, double value) { logIncrementValue(indexOf(label), value); }
/** * 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 * * @return the probabilities of the tag at the end of the table */ public double[] conditionalLogProbsGivenPrevious(int[] given) { if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbsGivenPrevious requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } double[] result = new double[numClasses]; for (int i = 0; i < numClasses; i++) { int index = indexOf(given, i); result[i] = table[index]; } ArrayMath.logNormalize(result); return result; }
/** * 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 * * @return the probability of the tag of being at the beginning of the table */ public double conditionalLogProbGivenNext(int[] given, int of) { if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenNext requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } int[] label = indicesEnd(given); double[] masses = new double[label.length]; for (int i = 0; i < masses.length; i++) { masses[i] = table[label[i]]; } double z = ArrayMath.logSum(masses); return table[indexOf(of, given)] - z; }