Package uk.ac.cam.ch.wwmm.ptclib.misc

Examples of uk.ac.cam.ch.wwmm.ptclib.misc.ClassificationEvaluator.logEvent()


      Collection<String> f = overallFeatures.get(word);
      String type = chemFeatures.containsKey(word) ? "CHEM" : "NONCHEM";
     
      double [] results = gm.eval(f.toArray(new String[0]));
      System.out.println(word + "\t" + gm.getAllOutcomes(results));
      ce.logEvent(type, gm.getBestOutcome(results));
      if(!gm.getBestOutcome(results).equals(type)) System.out.println("*");
      if(type.equals("CHEM")) {
        chemList.add(results[gm.getIndex("CHEM")]);
      } else {
        engList.add(results[gm.getIndex("CHEM")]);
View Full Code Here


        System.out.println(word + "\t" + bestWord);
        if(!type.equals(testType)) {
          System.out.println("*");
        }
       
        ce2.logEvent(type, testType);
      }
      ce2.pprintPrecisionRecallEval();     
    }
  }

View Full Code Here

      DecisionTree dt = new DecisionTree(bagEvents);
      dt.printTree();
      for(int i=0;i<testBagEvents.size();i++) {
        BagEvent be = testBagEvents.get(i);
        String result = dt.testBag(be.getFeatures());
        ce.logEvent(be.getClassLabel(), result);
      }
      System.out.println(ce.getAccuracy());
      System.out.println(ce.getKappa());     
      ce.pprintConfusionMatrix();
      ce.pprintPrecisionRecallEval();
View Full Code Here

      ce = new ClassificationEvaluator();
      DecisionList dl = new DecisionList(bagEvents);
      for(int i=0;i<testBagEvents.size();i++) {
        BagEvent be = testBagEvents.get(i);
        String result = dl.testBag(be.getFeatures());
        ce.logEvent(be.getClassLabel(), result);
      }
      System.out.println(ce.getAccuracy());
      System.out.println(ce.getKappa());     
      ce.pprintConfusionMatrix();
      ce.pprintPrecisionRecallEval();
View Full Code Here

    for(int i=0;i<testBagEvents.size();i++) {
      BagEvent be = testBagEvents.get(i);
      //Map<String,Double> results = mnb.testBag(be.getClassLabel(), be.getFeatures());
      Map<String,Double> results = mnb.testBag(be.getFeatures());
      System.out.println(be.getClassLabel() + "\t" + mnb.testBag(be.getFeatures()));
      ce.logEvent(be.getClassLabel(), mnb.bestResult(results));
    }
    System.out.println(ce.getAccuracy());
    System.out.println(ce.getKappa());     
    ce.pprintConfusionMatrix();
    ce.pprintPrecisionRecallEval();
View Full Code Here

    for(Event event : testEvents) {
      double [] results = gm.eval(event.getContext());
      String result = results[gm.getIndex("TRUE")] > 0.5 ? "TRUE" : "FALSE";
      //String result = gm.getBestOutcome(results);
      //System.out.println(event.getOutcome() + "\t" + result + "\t" + results[gm.getIndex(event.getOutcome())] + "\t" + StringTools.arrayToList(event.getContext()));
      ce.logEvent(event.getOutcome(), result);
    }
    System.out.println(ce.getAccuracy());
    System.out.println(ce.getKappa());     
    ce.pprintConfusionMatrix();
    ce.pprintPrecisionRecallEval();
View Full Code Here

        thisncp += Math.log(pdf(ut.get(i,j), ncmeans.get(i), ncstdevs.get(i)));
      }
      String refClass = chemSet.contains(terms.get(j)) ? "CHEM" : "NONCHEM";
      String respClass = thiscp > thisncp ? "CHEM" : "NONCHEM";
      System.out.println(terms.get(j) + "\t" + (thiscp - thisncp));
      ce.logEvent(refClass, respClass);
    }
    System.out.println(ce.getAccuracy());
    System.out.println(ce.getKappa());
    ce.pprintConfusionMatrix();
    ce.pprintPrecisionRecallEval();
View Full Code Here

      for(int i=0;i<eventBags.size();i++) {
        BagEvent be = eventBags.get(i);
      //for(BagEvent be : eventBags) {
        Map<String,Double> results = mnb.testBag(be.getClassLabel(), be.getFeatures());
        System.out.println(be.getClassLabel() + "\t" + mnb.testBag(be.getFeatures()));
        ce.logEvent(be.getClassLabel(), mnb.bestResult(results));
        String rf = "MNB:" + mnb.bestResult(results);
        Event e = events.get(i);
        String [] sa = new String[e.getContext().length + 1];
        for(int j=0;j<e.getContext().length;j++) {
          sa[j] = e.getContext()[j];
View Full Code Here

      for(Event event : testData) {
        double [] results = gm.eval(event.getContext());
        String result = results[gm.getIndex("TRUE")] > 0.5 ? "TRUE" : "FALSE";
        //String result = gm.getBestOutcome(results);
        //System.out.println(event.getOutcome() + "\t" + result + "\t" + results[gm.getIndex(event.getOutcome())] + "\t" + StringTools.arrayToList(event.getContext()));
        ce.logEvent(event.getOutcome(), result);
      }
      System.out.println("seed: " + seed);
      System.out.println(ce.getAccuracy());
      System.out.println(ce.getKappa());     
    //}
View Full Code Here

      DecisionTree dt = new DecisionTree(bagEvents);
      dt.printTree();
      for(int i=0;i<testBagEvents.size();i++) {
        BagEvent be = testBagEvents.get(i);
        String result = dt.testBag(be.getFeatures());
        ce.logEvent(be.getClassLabel(), result);
      }
      System.out.println(ce.getAccuracy());
      System.out.println(ce.getKappa());     
      ce.pprintConfusionMatrix();
      ce.pprintPrecisionRecallEval();
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.