public class Cochromosome
extends java.lang.Object
This class implements the cooperative-competitive rule-based scheme of the CORE algorithm
Constructor and Description |
---|
Cochromosome()
default constructor.
|
Cochromosome(Cochromosome c)
Deep-copy constructor (but the arraylist of chromosomes
only copies the references to the chromosome objects!)
|
Modifier and Type | Method and Description |
---|---|
void |
addChromosome(Chromosome c)
Adds a chromosome to this list
|
double |
classify(InstanceSet ISet,
java.lang.String[] instancesIN,
java.lang.String[] instancesOUT)
Performs the classification of a data set for final results printing purposes.
|
boolean |
contains(Chromosome c)
Test if this cochromosome contains the specified chromosome
|
double |
evaluate(InstanceSet ISet)
Evaluates this cochromosome with the provided data set
|
int |
getMu()
Gets the mu parameter
|
int |
getNumGenes()
Gets the TOTAL number of genes across all chromosomes in this object
|
int |
getNumRules()
Gets the number of rules (chromosomes)
|
boolean |
isEvaluated()
Gets the evaluation condition
|
void |
removeChromosome(Chromosome c)
Remove the specified chromosome from this object
|
void |
removeChromosome(int c)
Removes the chromosome at the specified position
|
void |
setEvaluated(boolean newEval)
Sets the evaluation condition
|
void |
setMu(int newMu)
Sets a new mu value
|
public Cochromosome()
default constructor. Allocates new memory for the arrays
public Cochromosome(Cochromosome c)
Deep-copy constructor (but the arraylist of chromosomes only copies the references to the chromosome objects!)
c
- public void addChromosome(Chromosome c)
Adds a chromosome to this list
c
- the new chromosomepublic void removeChromosome(Chromosome c)
Remove the specified chromosome from this object
c
- the chromosome to be deletedpublic void removeChromosome(int c)
Removes the chromosome at the specified position
c
- the chromosome to be deletedpublic boolean contains(Chromosome c)
Test if this cochromosome contains the specified chromosome
c
- the chromosome we are looking forpublic int getNumRules()
Gets the number of rules (chromosomes)
public int getNumGenes()
Gets the TOTAL number of genes across all chromosomes in this object
public int getMu()
Gets the mu parameter
public void setMu(int newMu)
Sets a new mu value
newMu
- the new mupublic double evaluate(InstanceSet ISet)
Evaluates this cochromosome with the provided data set
ISet
- data set for testing this set of rulespublic boolean isEvaluated()
Gets the evaluation condition
public void setEvaluated(boolean newEval)
Sets the evaluation condition
newEval
- the new evaluation conditionpublic double classify(InstanceSet ISet, java.lang.String[] instancesIN, java.lang.String[] instancesOUT)
Performs the classification of a data set for final results printing purposes. Writes the input (known) class and the output (predicted) class in two arrays (previously created!!)
ISet
- the reference data setinstancesIN
- the array with size of examples. Will contain the known class labelsinstancesOUT
- the array with the predicted class labels