Package weka.classifiers

Examples of weka.classifiers.Evaluation.evaluateModel()


     * @return the error
     * @throws Exception if something goes wrong
     */
    protected double getMeanAbsoluteError(Instances data) throws Exception {
  Evaluation eval = new Evaluation(data);
  eval.evaluateModel(this,data);
  return eval.meanAbsoluteError();
    }

    /**
     * Helper function to find the minimum in an array of error values.
View Full Code Here


      trainCPUTimeElapsed = thMonitor.getThreadUserTime(thID) - CPUStartTime;
    trainTimeElapsed = System.currentTimeMillis() - trainTimeStart;
    testTimeStart = System.currentTimeMillis();
    if(canMeasureCPUTime)
      CPUStartTime = thMonitor.getThreadUserTime(thID);
    eval.evaluateModel(m_Classifier, test);
    if(canMeasureCPUTime)
      testCPUTimeElapsed = thMonitor.getThreadUserTime(thID) - CPUStartTime;
    testTimeElapsed = System.currentTimeMillis() - testTimeStart;
    thMonitor = null;
   
View Full Code Here

   
    //testing classifier
    testTimeStart = System.currentTimeMillis();
    if(canMeasureCPUTime)
      CPUStartTime = thMonitor.getThreadUserTime(thID);
    predictions = eval.evaluateModel(m_Classifier, test);
    if(canMeasureCPUTime)
      testCPUTimeElapsed = thMonitor.getThreadUserTime(thID) - CPUStartTime;
    testTimeElapsed = System.currentTimeMillis() - testTimeStart;
    thMonitor = null;
   
View Full Code Here

                    // use 5-fold cross-validation
                    ev.crossValidateModel(classifier, train, Math.min(train.numInstances(), 5), new Random(42));
                } else {
                    test.setClassIndex(1);
                    classifier.buildClassifier(train);
                    ev.evaluateModel(classifier, test);
                }
               
                m_ROCs[snpNum] = ev.weightedAreaUnderROC();

                if (snpNum % 1000 == 0) {
View Full Code Here

                        }



                            Evaluation eval = new Evaluation(WinningShuffle_Learn);
                            eval.evaluateModel(Classifier.makeCopy(cpyCls[bestIndex]), WinningShuffle_Hold);

                            //////Send to another sub for report generating
//                            generateReport(learn, hold, WinningShuffle_Learn, WinningShuffle_Hold, cpyCls[bestIndex], eval);
                            PhaseIIwrep.res_pctCorrect_valid = eval.pctCorrect();
                            PhaseIIwrep.res_ROC_valid = eval.weightedAreaUnderROC();
View Full Code Here

    private void validationWinner(Instances randData,Instances validShuff, Classifier currentClassifier) throws Exception{
        Evaluation eval_validationE = new Evaluation(randData);
        Classifier eval_clas = Classifier.makeCopy(currentClassifier);
        eval_clas.buildClassifier(randData);
        eval_validationE.evaluateModel(eval_clas, validShuff);

        PhaseIwrep.res_pctCorrect_valid = eval_validationE.pctCorrect();
        PhaseIwrep.res_ROC_valid = eval_validationE.weightedAreaUnderROC();

        PhaseIwrep.PII_scoreTypeUsed = ((K2) ((BayesNet) currentClassifier).getSearchAlgorithm()).getScoreType().getSelectedTag().getID();
View Full Code Here

            insample_ROC[0] = loggy_eval.weightedAreaUnderROC();
       
        Evaluation loggy_eval_validation = new Evaluation(learn);
        Classifier loggy_valid = Classifier.makeCopy(loggy_class);
        loggy_valid.buildClassifier(learn);
        loggy_eval_validation.evaluateModel(loggy_valid, hold);
        validation_ACC[0] = loggy_eval_validation.pctCorrect();
        validation_ROC[0] = loggy_eval_validation.weightedAreaUnderROC();
       
        // DECISION TABLE
        Classifier dtable_class = new DecisionTable();
View Full Code Here

            insample_ROC[1] = dtable_eval.weightedAreaUnderROC();
           
        Evaluation dtable_eval_validation = new Evaluation(learn);
        Classifier dtable_valid = Classifier.makeCopy(dtable_class);
        dtable_valid.buildClassifier(learn);
        dtable_eval_validation.evaluateModel(dtable_valid, hold);
        validation_ACC[1] = dtable_eval_validation.pctCorrect();
        validation_ROC[1] = dtable_eval_validation.weightedAreaUnderROC();
       
        }
        else if (learn.classAttribute().isNumeric()) // run a linear regression
View Full Code Here

            insample_ROC[0] = eval.weightedAreaUnderROC();
       
        Evaluation eval_validation = new Evaluation(learn);
        Classifier valid_loggy = Classifier.makeCopy(linReg);
        valid_loggy.buildClassifier(learn);
        eval_validation.evaluateModel(valid_loggy, hold);
            validation_ACC[0] = eval.pctCorrect();
            validation_ROC[0] = eval.weightedAreaUnderROC();       
        }
        }
        catch (Exception ex){System.out.println(ex.toString());}
View Full Code Here

      // Build the classifier
      filteredClassifier = clsCopy;
      filteredClassifier.buildClassifier(train);
     
      Evaluation eval = new Evaluation(train);
          eval.evaluateModel(filteredClassifier, test);
         
          System.out.println(eval.toSummaryString());
        System.out.println(eval.toMatrixString());
    }
    catch (Exception e) {
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.