Package org.fnlp.ml.classifier

Examples of org.fnlp.ml.classifier.TPredict


   */
  public abstract Object tag(String src);

  protected String[] _tag(Instance  inst)  {
    doProcess(inst);
    TPredict pred = getClassifier().classify(inst,Type.SEQ);
    if (pred == null)
      return new String[0];
    return (String[]) pred.getLabel(0);
  }
View Full Code Here


    int count1 =0,count2=0;
    int total = prototypes.size();
    System.out.println("实例数量:"+total);
    for(int i=0;i<total;i++){
      Instance inst = prototypes.get(i);
      TPredict pred = classify(inst, 1);
      if(pred.getLabel(0).equals(inst.getTarget()))
        count1++;
      prototypes.remove(i);
      TPredict pred2 = classify(inst, 1);
      if(pred2.getLabel(0).equals(inst.getTarget()))
        count2++;
      prototypes.add(i, inst);
    }
    System.out.println("Leave-zero-out正确率:"+count1*1.0f/total);
    System.out.println("Leave-one-out正确率:"+count2*1.0f/total);
 
View Full Code Here

    return inf.getBest(instance, nbest);
  }

  @Override
  public Predict classify(Instance instance, Type type, int n) {
    TPredict res = (TPredict) inf.getBest(instance, n);
    Predict pred = LabelParser.parse(res,factory.DefaultLabelAlphabet(),type);
    return pred;
  }
View Full Code Here

TOP

Related Classes of org.fnlp.ml.classifier.TPredict

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.