title: using weka Filter in java code
body: <p>I have a problem with using weka api in java. There are 41 features(or attributes) in my training and testing dataset. I want to take only 25 attributes (eg say 1,3,5,7,8,10.....) and remove other attributes during training and testing the classifier. I have read Weka's Filter manual available at <a href="http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Filter" rel="nofollow">http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Filter</a> and <a href="http://grepcode.com/file/repo1.maven.org/maven2/nz.ac.waikato.cms.weka/weka-stable/3.6.6/weka/filters/unsupervised/attribute/Remove.java" rel="nofollow">http://grepcode.com/file/repo1.maven.org/maven2/nz.ac.waikato.cms.weka/weka-stable/3.6.6/weka/filters/unsupervised/attribute/Remove.java</a>  but I could not understand how to use filter in my problem. Could you please help me how to write code for this situation. Your suggestions/help will be highly appreciated.</p>
  
  <p>My code is like this....</p>
  
  <pre><code>import weka.classifiers.meta.FilteredClassifier;
  import weka.classifiers.trees.J48;
  import weka.core.Instances;
  import weka.filters.Filter;
  import weka.filters.unsupervised.attribute.Remove;
  Instances train = ...   
   Instances test = ...   
  
  Here I want to take only 25 attributes(i.e column values) out of 41.
   Classifier cls = new J48();
   cls.buildClassifier(train);
   // evaluate classifier and print some statistics
   Evaluation eval = new Evaluation(train);
   eval.evaluateModel(cls, test);
  .....
  .....
  </code></pre>