All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.attributeSelection.GeneticSearch

java.lang.Object
   |
   +----weka.attributeSelection.ASSearch
           |
           +----weka.attributeSelection.GeneticSearch

public class GeneticSearch
extends ASSearch
implements StartSetHandler, OptionHandler
Class for performing a genetic based search.

For more information see:

David E. Goldberg (1989). Genetic algorithms in search, optimization and machine learning. Addison-Wesley.

Valid options are:

-Z
Sets the size of the population. (default = 20).

-G
Sets the number of generations to perform. (default = 5).

-C
Sets the probability that crossover will occur. (default = .6).

-M
Sets the probability that a feature will be toggled on/off.

-R
Sets how frequently reports will be generated. Eg, setting the value to 5 will generate a report every 5th generation.

(default = number of generations).

-S
Sets the seed for random number generation.

Version:
$Revision: 1.6 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Constructor Index

 o GeneticSearch()
Constructor.

Method Index

 o getCrossoverProb()
get the probability of crossover
 o getMaxGenerations()
get the number of generations
 o getMutationProb()
get the probability of mutation
 o getOptions()
Gets the current settings of ReliefFAttributeEval.
 o getPopulationSize()
get the size of the population
 o getReportFrequency()
get how often repports are generated
 o getSeed()
get the value of the random number generator's seed
 o getStartSet()
Returns a list of attributes (and or attribute ranges) as a String
 o listOptions()
Returns an enumeration describing the available options
 o search(ASEvaluation, Instances)
Searches the attribute subset space using a genetic algorithm.
 o setCrossoverProb(double)
set the probability of crossover
 o setMaxGenerations(int)
set the number of generations to evaluate
 o setMutationProb(double)
set the probability of mutation
 o setOptions(String[])
Parses a given list of options.
 o setPopulationSize(int)
set the population size
 o setReportFrequency(int)
set how often reports are generated
 o setSeed(int)
set the seed for random number generation
 o setStartSet(String)
Sets a starting set of attributes for the search.
 o toString()
returns a description of the search

Constructors

 o GeneticSearch
 public GeneticSearch()
Constructor. Make a new GeneticSearch object

Methods

 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

Returns:
an enumeration of all the available options
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-Z
Sets the size of the population. (default = 20).

-G
Sets the number of generations to perform. (default = 5).

-C
Sets the probability that crossover will occur. (default = .6).

-M
Sets the probability that a feature will be toggled on/off.

-R
Sets how frequently reports will be generated. Eg, setting the value to 5 will generate a report every 5th generation.

(default = number of generations).

-S
Sets the seed for random number generation.

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o getOptions
 public String[] getOptions()
Gets the current settings of ReliefFAttributeEval.

Returns:
an array of strings suitable for passing to setOptions()
 o setStartSet
 public void setStartSet(String startSet) throws Exception
Sets a starting set of attributes for the search. It is the search method's responsibility to report this start set (if any) in its toString() method.

Parameters:
startSet - a string containing a list of attributes (and or ranges), eg. 1,2,6,10-15.
Throws: Exception
if start set can't be set.
 o getStartSet
 public String getStartSet()
Returns a list of attributes (and or attribute ranges) as a String

Returns:
a list of attributes (and or attribute ranges)
 o setSeed
 public void setSeed(int s)
set the seed for random number generation

Parameters:
s - seed value
 o getSeed
 public int getSeed()
get the value of the random number generator's seed

Returns:
the seed for random number generation
 o setReportFrequency
 public void setReportFrequency(int f)
set how often reports are generated

Parameters:
f - generate reports every f generations
 o getReportFrequency
 public int getReportFrequency()
get how often repports are generated

Returns:
how often reports are generated
 o setMutationProb
 public void setMutationProb(double m)
set the probability of mutation

Parameters:
m - the probability for mutation occuring
 o getMutationProb
 public double getMutationProb()
get the probability of mutation

Returns:
the probability of mutation occuring
 o setCrossoverProb
 public void setCrossoverProb(double c)
set the probability of crossover

Parameters:
c - the probability that two population members will exchange genetic material
 o getCrossoverProb
 public double getCrossoverProb()
get the probability of crossover

Returns:
the probability of crossover
 o setMaxGenerations
 public void setMaxGenerations(int m)
set the number of generations to evaluate

Parameters:
m - the number of generations
 o getMaxGenerations
 public int getMaxGenerations()
get the number of generations

Returns:
the maximum number of generations
 o setPopulationSize
 public void setPopulationSize(int p)
set the population size

Parameters:
p - the size of the population
 o getPopulationSize
 public int getPopulationSize()
get the size of the population

Returns:
the population size
 o toString
 public String toString()
returns a description of the search

Returns:
a description of the search as a String
Overrides:
toString in class Object
 o search
 public int[] search(ASEvaluation ASEval,
                     Instances data) throws Exception
Searches the attribute subset space using a genetic algorithm.

Parameters:
ASEvaluator - the attribute evaluator to guide the search
data - the training instances.
Returns:
an array (not necessarily ordered) of selected attribute indexes
Throws: Exception
if the search can't be completed
Overrides:
search in class ASSearch

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home