Package edu.stanford.nlp.util

Examples of edu.stanford.nlp.util.Index


  public static FloatFactorTable getFloatFactorTable(float[][] weights, int[][] data, List<Index<CRFLabel>> labelIndices, int numClasses) {

    FloatFactorTable factorTable = null;

    for (int j = 0; j < labelIndices.size(); j++) {
      Index labelIndex = labelIndices.get(j);
      FloatFactorTable ft = new FloatFactorTable(numClasses, j + 1);
     
      // ...and each possible labeling for that clique
      for (int k = 0; k < labelIndex.size(); k++) {
        int[] label = ((CRFLabel) labelIndex.get(k)).getLabel();
        float weight = 0.0f;
        for (int m = 0; m < data[j].length; m++) {
          //System.err.println("**"+weights[data[j][m]][k]);     
          weight += weights[data[j][m]][k];
        }
View Full Code Here


      // get predicted count
      for (int i = 0; i < data[m].length; i++) {
        // go through each clique...
        for (int j = 0; j < data[m][i].length; j++) {
          Index labelIndex = labelIndices.get(j);
          // ...and each possible labeling for that clique
          for (int k = 0; k < labelIndex.size(); k++) {
            int[] label = ((CRFLabel) labelIndex.get(k)).getLabel();

            // float p = Math.pow(Math.E, factorTables[i].logProbEnd(label));
            float p = (float) Math.exp(factorTables[i].unnormalizedLogProbEnd(label) - z);
            for (int n = 0; n < data[m][i][j].length; n++) {
              E[data[m][i][j][n]][k] += p;
View Full Code Here

        }
   
        // go through each clique...
        for (int j = 0; j < data[d][e].length; j++) {
          Index labelIndex = labelIndices.get(j);
       
          // ...and each possible labeling for that clique
          for (int k = 0; k < labelIndex.size(); k++) {
            int[] label = ((CRFLabel) labelIndex.get(k)).getLabel();
     
            // float p = Math.pow(Math.E, factorTables[i].logProbEnd(label));
            float p = probs[j][k];
            for (int n = 0; n < data[d][e][j].length; n++) {
              E[data[d][e][j][n]][k] += p;
View Full Code Here

      List<Index<CRFLabel>> labelIndices, int numClasses) {

    FactorTable factorTable = null;

    for (int j = 0, sz = labelIndices.size(); j < sz; j++) {
      Index labelIndex = labelIndices.get(j);
      FactorTable ft = new FactorTable(numClasses, j + 1);

      // ... and each possible labeling for that clique
      for (int k = 0, liSize = labelIndex.size(); k < liSize; k++) {
        int[] label = ((CRFLabel) labelIndex.get(k)).getLabel();
        double weight = 0.0;
        for (int m = 0; m < data[j].length; m++) {
          int wi = weightIndices[data[j][m]][k];
          weight += wscale * weights[wi];
        }
View Full Code Here

  static FactorTable getFactorTable(int[][] data, List<Index<CRFLabel>> labelIndices, int numClasses,
      CliquePotentialFunction cliquePotentialFunc, double[][] featureValByCliqueSize, int posInSent) {
    FactorTable factorTable = null;

    for (int j = 0, sz = labelIndices.size(); j < sz; j++) {
      Index labelIndex = labelIndices.get(j);
      FactorTable ft = new FactorTable(numClasses, j + 1);
      double[] featureVal = null;
      if (featureValByCliqueSize != null)
        featureVal = featureValByCliqueSize[j];

      // ... and each possible labeling for that clique
      for (int k = 0, liSize = labelIndex.size(); k < liSize; k++) {
        int[] label = ((CRFLabel) labelIndex.get(k)).getLabel();
        double cliquePotential = cliquePotentialFunc.computeCliquePotential(j+1, k, data[j], featureVal, posInSent);
        // for (int m = 0; m < data[j].length; m++) {
        //   weight += weights[data[j][m]][k];
        // }
        // try{
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.util.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.