/** uses the meta-classifier */
 protected static void useClassifier(Instances data) throws Exception {
   System.out.println("\n1. Meta-classfier");
   AttributeSelectedClassifier classifier = new AttributeSelectedClassifier();
   CfsSubsetEval eval = new CfsSubsetEval();
   GreedyStepwise search = new GreedyStepwise();
   search.setSearchBackwards(true);
   J48 base = new J48();
   classifier.setClassifier(base);
   classifier.setEvaluator(eval);
   classifier.setSearch(search);
   Evaluation evaluation = new Evaluation(data);
   evaluation.crossValidateModel(classifier, data, 10, new Random(1));
   System.out.println(evaluation.toSummaryString());
 }
  @Test
  public void train_attributeSelectedJ48_innerClassifierIsJ48() {
    // Arrange
    String classifierString =
        "weka.classifiers.meta.AttributeSelectedClassifier -E \"weka.attributeSelection.CfsSubsetEval\" -S \"weka.attributeSelection.BestFirst -D 1 -N 5\" -W weka.classifiers.trees.J48 -- -C 0.25 -M 2";

    // Act
    GeneralTrainer attributeSelectedTrainer = createGeneralTrainer(classifierString);
    AttributeSelectedClassifier attributeSelectedClassifier =
        (AttributeSelectedClassifier) attributeSelectedTrainer.train(getTestInstances());

    // Assert
    assertTrue(
        "Classifier within wrapper should be J48",
        attributeSelectedClassifier.getClassifier() instanceof J48);
  }