public class SEM
extends java.lang.Object
This class implements the SEM algorithm of the OIGA method, which evolves mono-attribute rules.
Constructor and Description |
---|
SEM()
Default constructor.
|
SEM(int pobSize,
int numberRules,
int attSel,
InstanceSet IS)
Parametrized constructor
|
Modifier and Type | Method and Description |
---|---|
void |
crossOver()
It performs a one point crossover in the new poblation, using adjacent chromosomes as parents
|
void |
elitism()
Copy the survivorsPercent proportion of the old poblation into the bottom half of
the new one
|
void |
evaluate()
Its evaluate the NEW poblation, using a metric which summarizes the train CR and
test CR
|
RuleSet |
getChromosome(int i)
Gets the i-th chromosome
|
double |
getCR()
Gets the Classification Rate of this SEM
|
void |
mutate()
Applies mutation in the new poblation
|
void |
onePointCrossover(int cr1,
int cr2)
One-point crossover
|
void |
run()
It runs the Single-attribute Evolution Module (SEM) algorithm to obtain a rule set of ONE attribute
|
void |
selection()
Applies a roulette wheel selection
|
void |
setGAparams(double mutationProb,
double crossoverRate,
double survivorsPercent)
Set the parameters for this SEM
|
void |
setGenerationLimit(int iters)
Set the generations limit
|
void |
setIS(InstanceSet dataset)
Sets the reference data set for this SEM
|
void |
tournament_selection()
Applies a tournament selection, with tournament size of 2
|
public SEM()
Default constructor. No memory allocated
public SEM(int pobSize, int numberRules, int attSel, InstanceSet IS)
pobSize
- number of chromosomes (rule sets)numberRules
- number of rules of each chromosomeattSel
- attribute used to evolve in this SEMIS
- the data set used for train the SEMpublic void setIS(InstanceSet dataset)
dataset
- new data set for trainingpublic void setGenerationLimit(int iters)
iters
- maximum number of iterations of the SEMpublic void setGAparams(double mutationProb, double crossoverRate, double survivorsPercent)
mutationProb
- the mutation probabilitycrossoverRate
- the crossoverProbability between 2 parentssurvivorsPercent
- the percent of parents that will be maintained from a generation to next onepublic double getCR()
public RuleSet getChromosome(int i)
i
- the rule set we want to retrievepublic void onePointCrossover(int cr1, int cr2)
cr1
- index of parent 1 in poblationcr2
- index of parent 2 in poblationpublic void crossOver()
public void elitism()
public void mutate()
public void selection()
public void tournament_selection()
public void evaluate()
public void run()