All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.filters.unsupervised.instance.RemoveWithValues Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.6
Show newest version
/*
 *   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 .
 */

/*
 *    RemoveWithValues.java
 *    Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.filters.unsupervised.instance;

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;

/**
 *  Filters instances according to the value of an
 * attribute.
 * 

* * * Valid options are: *

* *

 * -C <num>
 *  Choose attribute to be used for selection.
 * 
* *
 * -S <num>
 *  Numeric value to be used for selection on numeric
 *  attribute.
 *  Instances with values smaller than given value will
 *  be selected. (default 0)
 * 
* *
 * -L <index1,index2-index4,...>
 *  Range of label indices to be used for selection on
 *  nominal attribute.
 *  First and last are valid indexes. (default all values)
 * 
* *
 * -M
 *  Missing values count as a match. This setting is
 *  independent of the -V option.
 *  (default missing values don't match)
 * 
* *
 * -V
 *  Invert matching sense.
 * 
* *
 * -H
 *  When selecting on nominal attributes, removes header
 *  references to excluded values.
 * 
* *
 * -F
 *  Do not apply the filter to instances that arrive after the first
 *  (training) batch. The default is to apply the filter (i.e.
 *  the filter may not return an instance if it matches the remove criteria)
 * 
* * * * @author Eibe Frank ([email protected]) * @version $Revision: 14508 $ */ public class RemoveWithValues extends Filter implements UnsupervisedFilter, StreamableFilter, OptionHandler, WeightedInstancesHandler, WeightedAttributesHandler { /** for serialization */ static final long serialVersionUID = 4752870193679263361L; /** The attribute's index setting. */ private final SingleIndex m_AttIndex = new SingleIndex("last"); /** Stores which values of nominal attribute are to be used for filtering. */ protected Range m_Values; /** Stores which value of a numeric attribute is to be used for filtering. */ protected double m_Value = 0; /** True if missing values should count as a match */ protected boolean m_MatchMissingValues = false; /** Modify header for nominal attributes? */ protected boolean m_ModifyHeader = false; /** If m_ModifyHeader, stores a mapping from old to new indexes */ protected int[] m_NominalMapping; /** Whether to filter instances after the first batch has been processed */ protected boolean m_dontFilterAfterFirstBatch = false; /** * Returns a string describing this classifier * * @return a description of the classifier suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "Filters instances according to the value of an attribute."; } /** Default constructor */ public RemoveWithValues() { m_Values = new Range("first-last"); m_Values.setInvert(true); } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy