Example usage for weka.filters MultiFilter setOptions

List of usage examples for weka.filters MultiFilter setOptions

Introduction

In this page you can find the example usage for weka.filters MultiFilter setOptions.

Prototype

@Override
public void setOptions(String[] options) throws Exception 

Source Link

Document

Parses a list of options for this object.

Usage

From source file:com.deafgoat.ml.prognosticator.InstancesFilter.java

License:Apache License

/**
 * Applies a filter to remove supplied attribute names from the set of
 * instances//from   w  ww.j a  v a 2 s .  com
 * 
 * @param names
 *            The name(s) of the attribute(s) to remove
 * @throws Exception
 *             If filter could not be applied
 */
public void removeNameFilter(String[] names) throws Exception {
    if (_logger.isDebugEnabled()) {
        _logger.debug("Applying remove type filter");
    }
    // Might employ filtered classifier for production
    MultiFilter mf = new MultiFilter();
    String[] options = new String[names.length * 2];
    for (int i = 0; i < options.length; i++) {
        if (i % 2 == 0) {
            options[i] = "-F";
        } else {
            options[i] = "weka.filters.unsupervised.attribute.Remove -R " + _attributeMap.get(names[i / 2]);
        }
    }
    mf.setOptions(options);
    mf.setInputFormat(_instances);
    _instances = Filter.useFilter(_instances, mf);
}

From source file:com.deafgoat.ml.prognosticator.InstancesFilter.java

License:Apache License

/**
 * Applies a filter to remove supplied attribute types
 * /*from w w  w .j  a  va2  s  .c om*/
 * @param types
 *            The name(s) of the attribute type(s) to remove
 * @throws Exception
 *             Ifs filter could not be applied
 */
public void removeTypeFilter(String[] types) throws Exception {
    if (_logger.isDebugEnabled()) {
        _logger.debug("Applying remove type filter");
    }
    // Might employ filtered classifier for production
    MultiFilter mf = new MultiFilter();
    String[] options = new String[types.length * 2];
    for (int i = 0; i < options.length; i++) {
        if (i % 2 == 0) {
            options[i] = "-F";
        } else {
            options[i] = "weka.filters.unsupervised.attribute.RemoveType -T " + types[i / 2];
        }
    }
    mf.setOptions(options);
    mf.setInputFormat(_instances);
    _instances = Filter.useFilter(_instances, mf);
}