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

weka.filters.supervised.attribute.AttributeSelection 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 .
 */

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

package weka.filters.supervised.attribute;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;

import weka.attributeSelection.ASEvaluation;
import weka.attributeSelection.ASSearch;
import weka.attributeSelection.AttributeEvaluator;
import weka.attributeSelection.AttributeTransformer;
import weka.attributeSelection.BestFirst;
import weka.attributeSelection.CfsSubsetEval;
import weka.attributeSelection.Ranker;
import weka.core.*;
import weka.core.Capabilities.Capability;
import weka.filters.Filter;
import weka.filters.SupervisedFilter;

/**
  
 * A supervised attribute filter that can be used to
 * select attributes. It is very flexible and allows various search and
 * evaluation methods to be combined.
 * 

* * Valid options are: *

* *

 * -S <"Name of search class [search options]">
 *  Sets search method for subset evaluators.
 *  eg. -S "weka.attributeSelection.BestFirst -S 8"
 * 
* *
 * -E <"Name of attribute/subset evaluation class [evaluator options]">
 *  Sets attribute/subset evaluator.
 *  eg. -E "weka.attributeSelection.CfsSubsetEval -L"
 * 
* *
 * Options specific to evaluator weka.attributeSelection.CfsSubsetEval:
 * 
* *
 * -M
 *  Treat missing values as a seperate value.
 * 
* *
 * -L
 *  Don't include locally predictive attributes.
 * 
* *
 * Options specific to search weka.attributeSelection.BestFirst:
 * 
* *
 * -P <start set>
 *  Specify a starting set of attributes.
 *  Eg. 1,3,5-7.
 * 
* *
 * -D <0 = backward | 1 = forward | 2 = bi-directional>
 *  Direction of search. (default = 1).
 * 
* *
 * -N <num>
 *  Number of non-improving nodes to
 *  consider before terminating search.
 * 
* *
 * -S <num>
 *  Size of lookup cache for evaluated subsets.
 *  Expressed as a multiple of the number of
 *  attributes in the data set. (default = 1)
 * 
* * * @author Mark Hall ([email protected]) * @version $Revision: 14508 $ */ public class AttributeSelection extends Filter implements SupervisedFilter, OptionHandler, WeightedAttributesHandler, WeightedInstancesHandler { /** for serialization */ static final long serialVersionUID = -296211247688169716L; /** the attribute selection evaluation object */ private weka.attributeSelection.AttributeSelection m_trainSelector; /** the attribute evaluator to use */ private ASEvaluation m_ASEvaluator; /** the search method if any */ private ASSearch m_ASSearch; /** holds the selected attributes */ private int[] m_SelectedAttributes; /** True if a class attribute is set in the data */ protected boolean m_hasClass; /** * Returns a string describing this filter * * @return a description of the filter suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "A supervised attribute filter that can be used to select " + "attributes. It is very flexible and allows various search " + "and evaluation methods to be combined."; } /** * Constructor */ public AttributeSelection() { resetOptions(); } /** * 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