Examples of buildClassifier()


Examples of weka.classifiers.Classifier.buildClassifier()

          // As part of learning, we also prune some of the nodes where the ratio of correctly-classified pairs to those incorrectly classified is comparable.
          // The significant advantage of not pruning is that the result is no longer sensitive to the order of elements in the tree and hence does not depend on the order in which elements have been obtained by concurrent threads.
          //final weka.classifiers.lazy.IB1 ib1 = new weka.classifiers.lazy.IB1();
          //final weka.classifiers.trees.J48 classifier = new weka.classifiers.trees.J48();
          final Classifier classifier = repTree;
          classifier.buildClassifier(dataCollector.trainingData);
          System.out.println("Entries in the classifier: "+dataCollector.trainingData.numInstances());
          System.out.println(classifier);
          dataCollector=null;// throw all the training data away.
         
          {// serialise the classifier, this is the only way to store it.
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

          // As part of learning, we also prune some of the nodes where the ratio of correctly-classified pairs to those incorrectly classified is comparable.
          // The significant advantage of not pruning is that the result is no longer sensitive to the order of elements in the tree and hence does not depend on the order in which elements have been obtained by concurrent threads.
          //final weka.classifiers.lazy.IB1 ib1 = new weka.classifiers.lazy.IB1();
          //final weka.classifiers.trees.J48 classifier = new weka.classifiers.trees.J48();
          final Classifier classifier = repTree;
          classifier.buildClassifier(dataCollector.trainingData);
          System.out.println("Entries in the classifier: "+dataCollector.trainingData.numInstances());
          System.out.println(classifier);
          dataCollector=null;// throw all the training data away.
         
          {// serialise the classifier, this is the only way to store it.
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

        dataset.add(createInstance(dataset, "sunny", "true", 75, 70, "yes"));
        dataset.add(createInstance(dataset, "overcast", "true", 72, 90, "yes"));
        dataset.add(createInstance(dataset, "overcast", "false", 81, 75, "yes"));
        dataset.add(createInstance(dataset, "rain", "true", 71, 91, "no"));
        dataset.setClassIndex(4);
        classifier.buildClassifier(dataset);
        System.out.println(classifier);
       
        double result = classifier.classifyInstance(createInstance(dataset, "sunny", "false", 85, 85, Null.getValue()));
        assertEquals(1.0, result, .1);
        result = classifier.classifyInstance(createInstance(dataset, "sunny", "true", 80, 90, Null.getValue()));
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

        Classifier classifier;
        try
        {
          classifier = loadClassifier(options);
            classifier.buildClassifier(dataset);
           
            if(mSummaryOutput != null)
            {
                StringBuilder columns = new StringBuilder();
              columns.append("Trained on: [");
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

          throw new ActivityUserException(exc);
        }

        try
        {
            classifier.buildClassifier(dataset);
        }
        catch (Exception e)
        {
            throw new ActivityUserException(e);
        }
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

    trainCopy = Filter.useFilter(trainCopy, delTransform);
    o_Evaluation = new Evaluation(trainCopy);
    String [] oneROpts = { "-B", ""+getMinimumBucketSize()};
    Classifier oneR = Classifier.forName("weka.classifiers.rules.OneR", oneROpts);
    if (m_evalUsingTrainingData) {
      oneR.buildClassifier(trainCopy);
      o_Evaluation.evaluateModel(oneR, trainCopy);
    } else {
      /*      o_Evaluation.crossValidateModel("weka.classifiers.rules.OneR",
              trainCopy, 10,
              null, new Random(m_randomSeed)); */
 
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

      // build
      if (data.classAttribute().isNominal())
  classifier = new weka.classifiers.trees.J48();
      else
  classifier = new weka.classifiers.trees.M5P();
      classifier.buildClassifier(data);
     
      // record predictions
      result = new double[data.numInstances()];
      for (i = 0; i < result.length; i++)
  result[i] = classifier.classifyInstance(data.instance(i));
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

    try {
      current = Classifier.makeCopy(template);
    } catch (Exception ex) {
      m_Log.logMessage(Messages.getInstance().getString("ClassifierPanel_StartClassifier_Log_LogMessage_Text_Fifth") + ex.getMessage());
    }
    current.buildClassifier(train);
    Instances test = inst.testCV(numFolds, fold);
    m_Log.statusMessage(Messages.getInstance().getString("ClassifierPanel_StartClassifier_Log_StatusMessage_Text_Eleventh")
            + (fold + 1) + Messages.getInstance().getString("ClassifierPanel_StartClassifier_Log_StatusMessage_Text_Twelveth"));
    for (int jj=0;jj<test.numInstances();jj++) {
      processClassifierPrediction(test.instance(jj), current,
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

        try {
    current = Classifier.makeCopy(template);
        } catch (Exception ex) {
    m_Log.logMessage(Messages.getInstance().getString("ClassifierPanel_StartClassifier_Log_LogMessage_Text_Sixth") + ex.getMessage());
        }
        current.buildClassifier(train);
        eval = new Evaluation(train, costMatrix);
        m_Log.statusMessage(Messages.getInstance().getString("ClassifierPanel_StartClassifier_Log_StatusMessage_Text_Seventeenth"));
      
        if (outputPredictionsText) {
    printPredictionsHeader(outBuff, inst, Messages.getInstance().getString("ClassifierPanel_StartClassifier_PrintPredictionsHeader_Text_First"));
View Full Code Here

Examples of weka.classifiers.Classifier.buildClassifier()

          // We want to randomize the data the same way for every
          // learning scheme.
    train = newData.trainCV(m_NumXValFolds, j, new Random (1));
    test = newData.testCV(m_NumXValFolds, j);
    currentClassifier.buildClassifier(train);
    evaluation.setPriors(train);
    evaluation.evaluateModel(currentClassifier, test);
  }
      } else {
  currentClassifier.buildClassifier(train);
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.