Example usage for weka.filters.unsupervised.attribute RemoveType RemoveType

List of usage examples for weka.filters.unsupervised.attribute RemoveType RemoveType

Introduction

In this page you can find the example usage for weka.filters.unsupervised.attribute RemoveType RemoveType.

Prototype

RemoveType

Source Link

Usage

From source file:asap.NLPSystem.java

private Instances getFilteredSet(Instances set) {
    //TODO: filter all unwanted features
    if (set == null) {
        return null;
    }/*w  ww .  j  a va  2 s  .  c  om*/

    RemoveType removeTypeFilter = new RemoveType();
    String[] removeTypeFilterOptions = { "-T", "string" };
    Instances filteredSet = null;
    try {
        removeTypeFilter.setInputFormat(set);
        removeTypeFilter.setOptions(removeTypeFilterOptions);
        filteredSet = Filter.useFilter(set, removeTypeFilter);
    } catch (Exception ex) {
        Logger.getLogger(NLPSystem.class.getName()).log(Level.SEVERE, null, ex);
    }
    return filteredSet;
}

From source file:org.opentox.qsar.processors.filters.AttributeCleanup.java

License:Open Source License

private Instances remove(Instances input, ATTRIBUTE_TYPE type) throws QSARException {
    RemoveType remover = new RemoveType();
    try {/*from  ww w .j a v a 2 s .  co  m*/
        remover.setInputFormat(input);
    } catch (Exception ex) {
        String message = "Invalid input format for attribute-type removing filter";
        throw new QSARException(Cause.XQF11, message, ex);
    }
    String typeRemoved = type.toString();
    Instances output = input;
    String[] options = new String[] { "-T", typeRemoved };
    try {
        remover.setOptions(options);
    } catch (Exception ex) {
        String message = "Invalid filter options for cleanup";
        throw new QSARException(Cause.XQF111, message, ex);
    }
    try {
        output = RemoveType.useFilter(input, remover);
    } catch (Exception ex) {
        String message = "The filter is unable to remove the specified type :" + typeRemoved;
        throw new QSARException(Cause.XQF212, message, ex);
    }
    return output;
}