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

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

Introduction

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

Prototype

@Override
public boolean setInputFormat(Instances instanceInfo) throws Exception 

Source Link

Document

Sets the format of the input instances.

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 w w . j a  v a  2s  .  c o m*/
 *
 * @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 av  a 2 s. c  o  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 w w w.j  a v a 2  s  . c  om
 *
 * @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;
}