Example usage for weka.filters.unsupervised.attribute RemoveByName setExpression

List of usage examples for weka.filters.unsupervised.attribute RemoveByName setExpression

Introduction

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

Prototype

public void setExpression(String value) 

Source Link

Document

Sets the regular expression to match the attribute names against.

Usage

From source file:etc.aloe.cscw2013.FeatureGenerationImpl.java

License:Open Source License

/**
 * Get a filter that removes the id attribute from the data set, necessary
 * before training./*from  w ww.j av a  2  s.  com*/
 *
 * @param examples
 * @return
 * @throws Exception
 */
protected Filter getRemoveIDFilter(ExampleSet examples) throws Exception {
    RemoveByName filter = new RemoveByName();
    filter.setExpression(Pattern.quote(ExampleSet.ID_ATTR_NAME));

    filter.setInputFormat(examples.getInstances());
    Instances filtered = Filter.useFilter(examples.getInstances(), filter);
    examples.setInstances(filtered);

    return filter;
}

From source file:etc.aloe.cscw2013.FeatureGenerationImpl.java

License:Open Source License

/**
 * Get a filter that removes the id attribute from the data set, necessary
 * before training.//from   w w w.  j a va 2s  .  co m
 *
 * @param examples
 * @return
 * @throws Exception
 */
protected Filter getRemoveParticipantFilter(ExampleSet examples) throws Exception {
    RemoveByName filter = new RemoveByName();
    filter.setExpression(Pattern.quote(ExampleSet.PARTICIPANT_ATTR_NAME));

    filter.setInputFormat(examples.getInstances());
    Instances filtered = Filter.useFilter(examples.getInstances(), filter);
    examples.setInstances(filtered);

    return filter;
}

From source file:etc.aloe.oilspill2010.BigramFeatureGenerationImpl.java

/**
 * Get a filter that removes the id attribute from the data set, necessary
 * before training.//from  www .j a va  2 s  .  com
 *
 * @param examples
 * @return
 * @throws Exception
 */
protected Filter getRemoveMessageFilter(ExampleSet examples) throws Exception {
    RemoveByName filter = new RemoveByName();
    filter.setExpression(Pattern.quote(ExampleSet.MESSAGE_ATTR_NAME));

    filter.setInputFormat(examples.getInstances());
    Instances filtered = Filter.useFilter(examples.getInstances(), filter);
    examples.setInstances(filtered);

    return filter;
}