[Home] DMelt member access. Java source code: weka.filters.unsupervised.attribute.FirstOrder
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* FirstOrder.java
* Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.filters.unsupervised.attribute;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Vector;
import weka.core.*;
import weka.core.Capabilities.Capability;
import weka.filters.Filter;
import weka.filters.StreamableFilter;
import weka.filters.UnsupervisedFilter;
/**
* This instance filter takes a range of N numeric
* attributes and replaces them with N-1 numeric attributes, the values of which
* are the difference between consecutive attribute values from the original
* instance. eg:
*
* Original attribute values
*
* 0.1, 0.2, 0.3, 0.1, 0.3
*
* New attribute values
*
* 0.1, 0.1, -0.2, 0.2
*
* The range of attributes used is taken in numeric order. That is, a range spec
* of 7-11,3-5 will use the attribute ordering 3,4,5,7,8,9,10,11 for the
* differences, NOT 7,8,9,10,11,3,4,5.
*
*
*
* Valid options are:
*
*
*
* -R <index1,index2-index4,...>
* Specify list of columns to take the differences between.
* First and last are valid indexes.
* (default none)
*
*
*
*
* @author Len Trigg (trigg@cs.waikato.ac.nz)
* @version $Revision: 14508 $
*/
public class FirstOrder extends Filter implements UnsupervisedFilter,
StreamableFilter, OptionHandler, WeightedInstancesHandler {
/** for serialization */
static final long serialVersionUID = -7500464545400454179L;
/** Stores which columns to take differences between */
protected Range m_DeltaCols = new Range();
/**
* Returns a string describing this filter
*
* @return a description of the filter suitable for displaying in the
* explorer/experimenter gui
*/
public String globalInfo() {
return "This instance filter takes a range of N numeric attributes and replaces "
+ "them with N-1 numeric attributes, the values of which are the difference "
+ "between consecutive attribute values from the original instance. eg: \n\n"
+ "Original attribute values\n\n"
+ " 0.1, 0.2, 0.3, 0.1, 0.3\n\n"
+ "New attribute values\n\n"
+ " 0.1, 0.1, -0.2, 0.2\n\n"
+ "The range of attributes used is taken in numeric order. That is, a range "
+ "spec of 7-11,3-5 will use the attribute ordering 3,4,5,7,8,9,10,11 for the "
+ "differences, NOT 7,8,9,10,11,3,4,5.";
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
@Override
public Enumeration