title: Error while doing feature selection using wrapper and RandomForest Classifier in Java
body: <p>I'm doing wrapper feature selection with RandomForest classifier , and the code supposed to produce an new dataset with less or not needed features :</p>
  
  <pre><code>import weka.attributeSelection.*;
  import weka.core.Instances;
  import weka.filters.Filter;
  import weka.filters.supervised.attribute.AttributeSelection;
  import weka.core.converters.ArffSaver;
  import java.io.File;
  import weka.core.converters.ConverterUtils.DataSource;
  import weka.classifiers.trees.*;
  
  
  public class feature_selection
  {
      public static void main(String args[]) throws Exception{
          //load dataset
          DataSource source = new DataSource("/ProjectTraining&amp;TestingData/project/EECS738_Train_Project.arff");
          Instances dataset = source.getDataSet();
          dataset.setClassIndex(0);
  
          AttributeSelection filter = new AttributeSelection();
          WrapperSubsetEval wrapper = new WrapperSubsetEval();
          BestFirst search = new BestFirst();
          RandomForest base=new RandomForest();
  
          wrapper.setClassifier(base);
          filter.setEvaluator( wrapper);
          filter.setSearch(search);
          filter.setInputFormat(dataset);
  
          //apply
          Instances newData = Filter.useFilter(dataset, filter);
          //save
          ArffSaver saver = new ArffSaver();
          saver.setInstances(newData);
          saver.setFile(new File("/ProjectTraining&amp;TestingData/project/EECS738_Train_ProjectResult111.arff"));
          saver.writeBatch();
      }
  }
  </code></pre>
  
  <p>but I'm getting this following error : </p>
  
  <pre><code>Cannot build model (only class attribute present in data!), using ZeroR model instead!
  </code></pre>