|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ec.Problem ec.cgp.problems.ProblemCGP ec.cgp.problems.ClassificationProblem
public abstract class ClassificationProblem
An extension of CGPProblem which provides some facilities to represent and evaluate classification problems.
Field Summary | |
---|---|
(package private) static java.util.List<Record> |
data
storage for records |
(package private) static java.lang.String |
P_FILE
|
(package private) static java.lang.String |
P_TEST
|
(package private) static float |
test
proportion of records to reserve for the testing set (example: 0.3 = 30%) |
(package private) static java.util.List<Record> |
testSet
portion of the records used for testing/verification |
(package private) static java.util.List<Record> |
trainingSet
portion of the records used for training |
Fields inherited from class ec.cgp.problems.ProblemCGP |
---|
constantMax, constantMin, constants, numConstants, P_CONSTANT_MAX, P_CONSTANT_MIN, P_CONSTANTS |
Fields inherited from class ec.Problem |
---|
P_PROBLEM |
Constructor Summary | |
---|---|
ClassificationProblem()
|
Method Summary | |
---|---|
(package private) abstract boolean[] |
compare(java.lang.Object[] outputs,
Record r)
During evaluation, outputs are passed to this method. |
(package private) boolean[] |
eval(ec.EvolutionState state,
int threadnum,
java.lang.Object[] inputs,
Record rec,
VectorIndividualCGP ind)
Sets the inputs, runs the Cartesian Genetic Program, and returns the results of classification. |
void |
evaluate(ec.EvolutionState state,
ec.Individual ind,
int subpopulation,
int threadnum)
Evaluate this individual. |
(package private) abstract Record |
makeRecord(java.lang.String line)
Your implementing class must do the grunt work of turning a line from the text file into a Record instance that is specific to your problem. |
(package private) void |
makeRecords(java.lang.String fileName,
ec.util.MersenneTwisterFast rand)
Read lines of text from the input file and turn each line into a Record instance. |
(package private) abstract void |
setInputs(java.lang.Object[] inputs,
Record r)
Your implementing class must map attributes of the given Record to items in the input vector using this method. |
void |
setup(ec.EvolutionState state,
ec.util.Parameter base)
Configure this Classification Problem. |
Methods inherited from class ec.cgp.problems.ProblemCGP |
---|
describe, initConstants |
Methods inherited from class ec.Problem |
---|
canEvaluate, clone, closeContacts, defaultBase, finishEvaluating, initializeContacts, prepareToEvaluate, reinitializeContacts |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static java.util.List<Record> data
static java.util.List<Record> trainingSet
static java.util.List<Record> testSet
static java.lang.String P_FILE
static java.lang.String P_TEST
static float test
Constructor Detail |
---|
public ClassificationProblem()
Method Detail |
---|
public void setup(ec.EvolutionState state, ec.util.Parameter base)
setup
in interface ec.Prototype
setup
in interface ec.Setup
setup
in class ProblemCGP
void makeRecords(java.lang.String fileName, ec.util.MersenneTwisterFast rand)
fileName
- The full path of the input file.rand
- RNG to use.abstract Record makeRecord(java.lang.String line)
line
- The comma-delimited line from the data file.
public void evaluate(ec.EvolutionState state, ec.Individual ind, int subpopulation, int threadnum)
abstract void setInputs(java.lang.Object[] inputs, Record r)
inputs
- input array to setr
- record to set values fromabstract boolean[] compare(java.lang.Object[] outputs, Record r)
outputs
- The output vector resulting from evaluation of the CGP.r
- The record from which to compare classification results.
boolean[] eval(ec.EvolutionState state, int threadnum, java.lang.Object[] inputs, Record rec, VectorIndividualCGP ind)
state
- The evolution statethreadnum
- The current thread numberinputs
- The input vectorrec
- The current recordind
- The current individual
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |