Package com.clearnlp.classification.instance

Examples of com.clearnlp.classification.instance.StringInstance


    StringPrediction p = null;
   
    if (isTrain())
    {
      p = new StringPrediction(getGoldLabel(state), 1d);
      s_spaces[idx].addInstance(new StringInstance(p.label, vector));
    }
    else if (isDevelopOrDecode())
    {
      p = getAutoLabel(idx, vector, state);
    }
    else if (isBootstrap())
    {
      p = getAutoLabel(idx, vector, state);
      s_spaces[idx].addInstance(new StringInstance(getGoldLabel(state), vector));
    }

    return p;
  }
View Full Code Here


    String label = null;
   
    if (isTrain())
    {
      label = AbstractModel.getBooleanLabel(state.getGoldLabel() != null);
      insts.add(new StringInstance(label, vector));
    }
    else if (isDevelopOrDecode())
    {
      label = getAutoLabel(vector);
    }
View Full Code Here

    String label = null;
   
    if (isTrain())
    {
      label = state.getGoldLabel();
      if (vector.size() > 0) insts.add(new StringInstance(label, vector));
    }
    else if (isDevelopOrDecode())
    {
      label = getAutoLabel(vector, state);
    }
    else if (isBootstrap())
    {
      label = getAutoLabel(vector, state);
      if (vector.size() > 0) insts.add(new StringInstance(state.getGoldLabel(), vector));
    }
   
    return label;
  }
View Full Code Here

    String label = null;
   
    if (isTrain())
    {
      label = state.getGoldLabel();
      s_spaces[modelId].addInstance(new StringInstance(label, vector));
    }
    else if (isDevelopOrDecode())
    {
      label = getAutoLabel(vector, modelId);
    }
View Full Code Here

        r = pModel.predictBest(sp.o2);
        label = sp.o1;
      }
      else
      {
        StringInstance ss = StringTrainSpace.toInstance(line, hasWeight);
        r = sModel.predictBest(ss.getFeatureVector());
        label = ss.getLabel();
      }
     
      fout.println(r.label+" "+r.score);
      if (r.label.equals(label))  correct++;
      total++;
View Full Code Here

// ================================ BUILD ================================

  public void build(int labelCutoff, int featureCutoff)
  {
    SparseFeatureVector vector;
    StringInstance instance;
    int label;
   
    l_instances = Lists.newArrayList();
    buildLabels  (labelCutoff);
    buildFeatures(featureCutoff);
   
    while ((instance = i_collector.pollInstance()) != null)
    {
      if ((label = getLabelIndex(instance.getLabel())) < 0)
        continue;
     
      vector = toSparseFeatureVector(instance.getFeatureVector());
      if (!vector.isEmpty()) l_instances.add(new IntInstance(label, vector));
    }
  }
View Full Code Here

TOP

Related Classes of com.clearnlp.classification.instance.StringInstance

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.