Example usage for weka.attributeSelection CfsSubsetEval setMissingSeparate

List of usage examples for weka.attributeSelection CfsSubsetEval setMissingSeparate

Introduction

In this page you can find the example usage for weka.attributeSelection CfsSubsetEval setMissingSeparate.

Prototype

public void setMissingSeparate(boolean b) 

Source Link

Document

Treat missing as a separate value

Usage

From source file:trainableSegmentation.WekaSegmentation.java

License:GNU General Public License

/**
 * Select attributes using BestFirst search to reduce
 * the number of parameters per instance of a dataset
 *
 * @param data input set of instances/*from w ww . j  av a2 s.  c om*/
 * @return resampled set of instances
 */
public static Instances selectAttributes(Instances data) {
    final AttributeSelection filter = new AttributeSelection();
    Instances filteredIns = null;
    // Evaluator
    final CfsSubsetEval evaluator = new CfsSubsetEval();
    evaluator.setMissingSeparate(true);
    // Assign evaluator to filter
    filter.setEvaluator(evaluator);
    // Search strategy: best first (default values)
    final BestFirst search = new BestFirst();
    filter.setSearch(search);
    // Apply filter
    try {
        filter.setInputFormat(data);

        filteredIns = Filter.useFilter(data, filter);
    } catch (Exception e) {
        IJ.log("Error when resampling input data with selected attributes!");
        e.printStackTrace();
    }
    return filteredIns;

}