Package org.fnlp.ml.classifier.knn

Examples of org.fnlp.ml.classifier.knn.KNNClassifier.classify()


    System.out.println("Testing Knn...\n");
    count=0;
    for(int i=0;i<testset.size();i++){
      Instance data = testset.getInstance(i);
      Integer gold = (Integer) data.getTarget();
      Predict<String> pres=(Predict<String>) knn.classify(data, Type.STRING, 3);
      String pred_label=pres.getLabel();
      String gold_label = knn.getLabel(gold);
     
      if(pred_label.equals(gold_label)){
        //System.out.println(pred_label+" : "+testsetknn.getInstance(i).getTempData());
View Full Code Here


    fs.fS_CS(tf, 0.1f);
    knn.setFs(fs);
    for(int i=0;i<testset.size();i++){
      Instance data = testset.getInstance(i);
      Integer gold = (Integer) data.getTarget();
      Predict<String> pres=(Predict<String>) knn.classify(data, Type.STRING, 3);
      String pred_label=pres.getLabel();
      String gold_label = knn.getLabel(gold);
     
      if(pred_label.equals(gold_label)){
        //System.out.println(pred_label+" : "+testsetknn.getInstance(i).getTempData());
View Full Code Here

      }
      count=0;
      for(int i=0;i<testset.size();i++){
        Instance data = testset.getInstance(i);
        Integer gold = (Integer) data.getTarget();
        Predict<String> pres=(Predict<String>)knn.classify(data, Type.STRING, 3);
        String pred_label=pres.getLabel();
        String gold_label = knn.getLabel(gold);
       
        if(pred_label.equals(gold_label)){
          count++;
View Full Code Here

      }
      count=0;
      for(int i=0;i<testset.size();i++){
        Instance data = testset.getInstance(i);
        Integer gold = (Integer) data.getTarget();
        Predict<String> pres=(Predict<String>)knn.classify(data, Type.STRING, 3);
        String pred_label=pres.getLabel();
        String gold_label = knn.getLabel(gold);
       
        if(pred_label.equals(gold_label)){
          count++;
View Full Code Here

      }
      count=0;
      for(int i=0;i<testset.size();i++){
        Instance data = testset.getInstance(i);
        Integer gold = (Integer) data.getTarget();
        Predict<String> pres=(Predict<String>)knn.classify(data, Type.STRING, 3);
        String pred_label=pres.getLabel();
        String gold_label = knn.getLabel(gold);
       
        if(pred_label.equals(gold_label)){
          count++;
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.