Package weka.classifiers.meta

Examples of weka.classifiers.meta.FilteredClassifier


    }

    // Build classifier
    if (nominalClassValue) {

      FilteredClassifier fclass = new FilteredClassifier();
      fclass.setClassifier(new NaiveBayesSimple());
      fclass.setFilter(new Discretize());
      classifier = fclass;

      /*
       * classifier = new Bagging(); // try also //
       * classifier.setOptions(Utils.splitOptions("-P 10 -S 1 -I 10 -W
View Full Code Here


   * determined heuristically, derived tests might need to adjust it.
   *
   * @return the configured FilteredClassifier
   */
  protected FilteredClassifier getFilteredClassifier() {
    FilteredClassifier  result;
   
    result = new FilteredClassifier();
   
    result.setFilter(getFilter());
    result.setClassifier(new weka.classifiers.rules.ZeroR());
   
    return result;
  }
View Full Code Here

   * determined heuristically, derived tests might need to adjust it.
   *
   * @return the configured FilteredClassifier
   */
  protected FilteredClassifier getFilteredClassifier() {
    FilteredClassifier  result;
   
    result = new FilteredClassifier();
   
    result.setFilter(getFilter());
    result.setClassifier(new weka.classifiers.trees.J48());
   
    return result;
  }
View Full Code Here

   * determined heuristically, derived tests might need to adjust it.
   *
   * @return the configured FilteredClassifier
   */
  protected FilteredClassifier getFilteredClassifier() {
    FilteredClassifier  result;
   
    result = new FilteredClassifier();
   
    result.setFilter(getFilter());
    result.setClassifier(new weka.classifiers.trees.J48());
   
    return result;
  }
View Full Code Here

   * determined heuristically, derived tests might need to adjust it.
   *
   * @return the configured FilteredClassifier
   */
  protected FilteredClassifier getFilteredClassifier() {
    FilteredClassifier   result;
   
    result = super.getFilteredClassifier();
    ((NominalToString) result.getFilter()).setAttributeIndexes("1");
    result.setClassifier(new ZeroR());
   
    return result;
  }
View Full Code Here

   * determined heuristically, derived tests might need to adjust it.
   *
   * @return the configured FilteredClassifier
   */
  protected FilteredClassifier getFilteredClassifier() {
    FilteredClassifier  result;
   
    result = new FilteredClassifier();
   
    result.setFilter(getFilter());
    result.setClassifier(new weka.classifiers.trees.M5P());
   
    return result;
  }
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

        // filter for removing samples:
        Remove rm = new Remove();
        rm.setAttributeIndices("1")// remove 1st attribute

        // filtered classifier
        FilteredClassifier fc = new FilteredClassifier();
        fc.setFilter(rm);
        fc.setClassifier(j48);
        // train using stock_training_data.arff:
        fc.buildClassifier(training_data);
        // test using stock_testing_data.arff:
        for (int i = 0; i < testing_data.numInstances(); i++) {
          double pred = fc.classifyInstance(testing_data.instance(i));
          System.out.print("given value: " + testing_data.classAttribute().value((int)testing_data.instance(i).classValue()));
          System.out.println(". predicted value: " + testing_data.classAttribute().value((int) pred));
        }

  }
View Full Code Here

        };
        j48.setOptions(options);

        // Make sure we add the ClusterId attribute to a new MarkovAttributeSet so that
        // we can tell the Classifier to classify that!
        FilteredClassifier fc = new FilteredClassifier();
        MarkovAttributeSet classifier_aset = new MarkovAttributeSet(aset);
        classifier_aset.add(cluster_attr);
        fc.setFilter(classifier_aset.createFilter(newData));
        fc.setClassifier(j48);
       
        // Bombs away!
        fc.buildClassifier(newData);
       
        return (fc);
    }
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

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.