Examples of Predict


Examples of org.fnlp.ml.classifier.Predict

    return predN;
 
  @Override
  public TPredict classify(Instance instance, Type type, int n) {
    // TODO Auto-generated method stub
    Predict res = (Predict) classify(instance, n);
    return LabelParser.parse(res,factory.DefaultLabelAlphabet(),type);
  }
View Full Code Here

Examples of org.fnlp.ml.classifier.Predict

  }

  @Override
  public Predict classify(Instance instance, Type type, int n) {
    // TODO Auto-generated method stub
    Predict res = (Predict) classify(instance, n);
    return LabelParser.parse(res,factory.DefaultLabelAlphabet(),type);
  }
View Full Code Here

Examples of org.fnlp.ml.classifier.Predict

      beginTimeIter = System.currentTimeMillis();
      for (int ii = 0; ii < numSamples; ii++) {
       
        k++;
        Instance inst = trainset.getInstance(ii);
        Predict pred = (Predict) inferencer.getBest(inst,2);       
       
        float l = loss.calc(pred.getLabel(0), inst.getTarget());
        if (l > 0) {
          err += l;
          errtot++;
          update.update(inst, weights, k, extraweight, pred.getLabel(0), c);
         
        }else{
          if (pred.size() > 1)
            update.update(inst, weights, k, extraweight, pred.getLabel(1), c);
        }
        cnt += inst.length();
        cnttot++;       

        if (!simpleOutput && progress != 0 && ii % progress == 0) {
View Full Code Here

Examples of org.fnlp.ml.classifier.Predict

    float errtot = 0;
    int total = 0;
    for (int i = 0; i < devset.size(); i++) {
      Instance inst = devset.getInstance(i);
      total += inst.length();
      Predict pred = (Predict) inferencer.getBest(inst);
      float l = loss.calc(pred.getLabel(0), inst.getTarget());
      if (l > 0) {
        errtot += 1.0;
        err += l;
      }
View Full Code Here

Examples of org.fnlp.ml.classifier.Predict

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

Examples of org.fnlp.ml.classifier.Predict

    Loss loss = new HammingLoss();


    LabelAlphabet la = cl.getAlphabetFactory().DefaultLabelAlphabet();

    Predict xx = cl.classify(inst,5);
    double[] scores=new double[5];
    String[] sentenceout=new String[5];
    int[] pred;
    String[][] labelsSet = new String[xx.size()][];
    ArrayList<String> res = null;
    for(int j=0;j<xx.size();j++){
      pred = (int[]) xx.getLabel(j);
      float uuu = xx.getScore(j);
      labelsSet [j] = la.lookupString(pred);
      res = FormatCWS.toList(inst, labelsSet [j]);
//      System.out.println(res);
    }
View Full Code Here

Examples of org.fnlp.ml.classifier.Predict

  }

  @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

Examples of org.fnlp.ml.classifier.hier.Predict

        e.printStackTrace();
        return null;
      }
    }

    Predict pred = new Predict(n);
    Predict oracle = null;
    if(target!=null){
      oracle = new Predict(n);
    }

    TIntIterator it = leafs.iterator();

    while(it.hasNext()){
     
      float score=0;
      int i = it.next();

      if(tree!=null){//计算含层次信息的内积
        int[] anc = tree.getPath(i);
        for(int j=0;j<anc.length;j++){
          score += sw[anc[j]];
        }
      }else{
        score = sw[i];
      }

      //给定目标范围是,只计算目标范围的值
      if(target!=null&&target.equals(i)){
        oracle.add(i,score);
      }else{
        pred.add(i,score);
      }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.