Package weka.attributeSelection
Class ASSearch
- java.lang.Object
-
- weka.attributeSelection.ASSearch
-
- All Implemented Interfaces:
Serializable,OptionHandler,RevisionHandler
- Direct Known Subclasses:
BestFirst,GreedyStepwise,Ranker
public abstract class ASSearch extends Object implements Serializable, RevisionHandler, OptionHandler
Abstract attribute selection search class.- Version:
- $Revision$
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ASSearch()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ASSearchforName(String searchName, String[] options)Creates a new instance of a search class given it's class name and (optional) arguments to pass to it's setOptions method.String[]getOptions()Gets the current settings of the search.StringgetRevision()Returns the revision string.Enumeration<Option>listOptions()Returns an enumeration describing the available options.static ASSearch[]makeCopies(ASSearch model, int num)Creates copies of the current search scheme.abstract int[]search(ASEvaluation ASEvaluator, Instances data)Searches the attribute subset/ranking space.voidsetOptions(String[] options)Parses a given list of options.
-
-
-
Method Detail
-
listOptions
public Enumeration<Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.- Specified by:
setOptionsin interfaceOptionHandler- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the search.- Specified by:
getOptionsin interfaceOptionHandler- Returns:
- an array of strings suitable for passing to setOptions
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
search
public abstract int[] search(ASEvaluation ASEvaluator, Instances data) throws Exception
Searches the attribute subset/ranking space.- Parameters:
ASEvaluator- the attribute evaluator to guide the searchdata- the training instances.- Returns:
- an array (not necessarily ordered) of selected attribute indexes
- Throws:
Exception- if the search can't be completed
-
forName
public static ASSearch forName(String searchName, String[] options) throws Exception
Creates a new instance of a search class given it's class name and (optional) arguments to pass to it's setOptions method. If the search method implements OptionHandler and the options parameter is non-null, the search method will have it's options set.- Parameters:
searchName- the fully qualified class name of the search classoptions- an array of options suitable for passing to setOptions. May be null.- Returns:
- the newly created search object, ready for use.
- Throws:
Exception- if the search class name is invalid, or the options supplied are not acceptable to the search class.
-
makeCopies
public static ASSearch[] makeCopies(ASSearch model, int num) throws Exception
Creates copies of the current search scheme. Note that this method now uses Serialization to perform a deep copy, so the search object must be fully Serializable. Any currently built model will now be copied as well.- Parameters:
model- an example search scheme to copynum- the number of search scheme copies to create.- Returns:
- an array of search schemes.
- Throws:
Exception- if an error occurs
-
-