Package org.fnlp.ml.classifier

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


  }

  @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

      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

    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

    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

    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

  }

  @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.Predict

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.