Package weka.classifiers.meta

Examples of weka.classifiers.meta.FilteredClassifier


         
          // Copy the classifier
          Classifier classifier = AbstractClassifier.makeCopy(baseClassifier);
                                
          // Instantiate the FilteredClassifier
          FilteredClassifier filteredClassifier = new FilteredClassifier();
          filteredClassifier.setFilter(removeIDFilter);
          filteredClassifier.setClassifier(classifier);
            
          // Build the classifier
          filteredClassifier.buildClassifier(train);
          
          // Evaluate
          eval.evaluateModel(filteredClassifier, test);
         
          // Add predictions
View Full Code Here


           
            // Copy the classifier
            Classifier classifier = AbstractClassifier.makeCopy(baseClassifier);
                                  
            // Instantiate the FilteredClassifier
            FilteredClassifier filteredClassifier = new FilteredClassifier();
            filteredClassifier.setFilter(removeIDFilter);
            filteredClassifier.setClassifier(classifier);
              
            // Build the classifier
            filteredClassifier.buildClassifier(train);
            
            // Evaluate
            eval.evaluateModel(classifier, test);
           
            // Add predictions
View Full Code Here

       
        // Copy the classifier
        Classifier classifier = AbstractClassifier.makeCopy(baseClassifier);
         
        // Instantiate the FilteredClassifier
        FilteredClassifier filteredClassifier = new FilteredClassifier();
        filteredClassifier.setFilter(removeIDFilter);
        filteredClassifier.setClassifier(classifier);
          
        // Build the classifier
        filteredClassifier.buildClassifier(train);
   
        // Prepare the output buffer
        AbstractOutput output = new PlainText();
        output.setBuffer(new StringBuffer());
        output.setHeader(test);
View Full Code Here

         
          // Copy the classifier
          Classifier classifier = AbstractClassifier.makeCopy(baseClassifier);
                                
          // Instantiate the FilteredClassifier
          FilteredClassifier filteredClassifier = new FilteredClassifier();
          filteredClassifier.setFilter(removeIDFilter);
          filteredClassifier.setClassifier(classifier);
            
          // Build the classifier
          filteredClassifier.buildClassifier(train);
         
          // Evaluate
          eval.evaluateModel(filteredClassifier, test);
         
          // Add predictions
View Full Code Here

    MakeIndicator filter = new MakeIndicator();
    filter.setAttributeIndex("" + (data.classIndex() + 1));
    filter.setValueIndices(m_Range.getRanges());
    filter.setNumeric(false);
    filter.setInputFormat(data);
    m_FilteredClassifier = new FilteredClassifier();
    if (data.numInstances() > 0) {
      m_FilteredClassifier.setClassifier(Classifier.makeCopies(classifier, 1)[0]);
    } else {
      m_FilteredClassifier.setClassifier(new weka.classifiers.rules.ZeroR());
    }
View Full Code Here

    MakeIndicator filter = new MakeIndicator();
    filter.setAttributeIndex("" + (data.classIndex() + 1));
    filter.setValueIndices(m_Range.getRanges());
    filter.setNumeric(false);
    filter.setInputFormat(data);
    m_FilteredClassifier = new FilteredClassifier();
    if (data.numInstances() > 0) {
      m_FilteredClassifier.setClassifier(Classifier.makeCopies(classifier, 1)[0]);
    } else {
      m_FilteredClassifier.setClassifier(new weka.classifiers.rules.ZeroR());
    }
View Full Code Here

      MakeIndicator filter = new MakeIndicator();
      filter.setAttributeIndex("" + (data.classIndex() + 1));
      filter.setValueIndices(node.m_right.getString());
      filter.setNumeric(false);
      filter.setInputFormat(data);
      FilteredClassifier classifier = new FilteredClassifier();
      if (data.numInstances() > 0) {
  classifier.setClassifier(Classifier.makeCopies(m_Classifier, 1)[0]);
      } else {
  classifier.setClassifier(new ZeroR());
      }
      classifier.setFilter(filter);
     
      if (!m_classifiers.containsKey(node.m_left.getString() + "|" + node.m_right.getString())) {
  classifier.buildClassifier(data);
  m_classifiers.put(node.m_left.getString() + "|" + node.m_right.getString(), classifier);
      } else {
  classifier=(FilteredClassifier)m_classifiers.get(node.m_left.getString() + "|" +
               node.m_right.getString());
      }
View Full Code Here

   * determined heuristically, derived tests might need to adjust it.
   *
   * @return the configured FilteredClassifier
   */
  protected FilteredClassifier getFilteredClassifier() {
    FilteredClassifier  result;
    Filter    filter;
    Classifier    cls;
   
    result = new FilteredClassifier();
   
    // set filter
    filter = getFilter();
    result.setFilter(filter);
   
    // set classifier
    if (filter.getCapabilities().handles(Capability.NOMINAL_CLASS))
      cls = new weka.classifiers.trees.J48();
    else if (filter.getCapabilities().handles(Capability.BINARY_CLASS))
      cls = new weka.classifiers.trees.J48();
    else if (filter.getCapabilities().handles(Capability.UNARY_CLASS))
      cls = new weka.classifiers.trees.J48();
    else if (filter.getCapabilities().handles(Capability.NUMERIC_CLASS))
      cls = new weka.classifiers.trees.M5P();
    else if (filter.getCapabilities().handles(Capability.DATE_CLASS))
      cls = new weka.classifiers.trees.M5P();
    else
      throw new IllegalStateException("Cannot determine base classifier for FilteredClassifier!");
    result.setClassifier(cls);
   
    return result;
  }
View Full Code Here

    }

    // Build classifier

   
    FilteredClassifier fclass = new FilteredClassifier();   
    fclass.setClassifier(new weka.classifiers.bayes.NaiveBayesSimple());
    fclass.setFilter(new Discretize());
    m_Classifier = fclass;
   
   
    // Uncomment if you want to use a different classifier
    // Caution: Other places in the code will have to be adjusted!!
View Full Code Here

TOP

Related Classes of weka.classifiers.meta.FilteredClassifier

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.