ec.cgp.problems
Class ProblemIris

java.lang.Object
  extended by ec.Problem
      extended by ec.cgp.problems.ProblemCGP
          extended by ec.cgp.problems.ClassificationProblem
              extended by ec.cgp.problems.ProblemIris
All Implemented Interfaces:
ec.Prototype, ec.Setup, ec.simple.SimpleProblemForm, java.io.Serializable, java.lang.Cloneable

public class ProblemIris
extends ClassificationProblem

The classic Iris classification problem. Data set originates from http://archive.ics.uci.edu/ml/datasets/Iris. Data file used comes from Weka: http://www.cs.waikato.ac.nz/ml/weka/ The task is to classify the species of Iris flower given a set of four numerical measurements.

Author:
David Oranchak, doranchak@gmail.com, http://oranchak.com
See Also:
Serialized Form

Nested Class Summary
static class ProblemIris.IrisRecord
          Record to represent a classification instance.
 
Field Summary
 
Fields inherited from class ec.cgp.problems.ClassificationProblem
data, P_FILE, P_TEST, test, testSet, trainingSet
 
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
ProblemIris()
           
 
Method Summary
(package private)  boolean[] compare(java.lang.Object[] outputs, Record rec)
          Determine the result of classification by comparing the evaluated outputs from our Cartsesian Genetic Program to the instance class(es) specified somewhere in the given Record.
(package private)  Record makeRecord(java.lang.String line)
          Interpret a line from the data file into a Record instance.
(package private)  void setInputs(java.lang.Object[] inputs, Record rec)
          Obtain the inputs from the data record.
 
Methods inherited from class ec.cgp.problems.ClassificationProblem
eval, evaluate, makeRecords, setup
 
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
 

Constructor Detail

ProblemIris

public ProblemIris()
Method Detail

makeRecord

Record makeRecord(java.lang.String line)
Interpret a line from the data file into a Record instance.

Specified by:
makeRecord in class ClassificationProblem
Parameters:
line - The comma-delimited line from the data file.
Returns:
an instance of the Record.

setInputs

void setInputs(java.lang.Object[] inputs,
               Record rec)
Obtain the inputs from the data record.

Specified by:
setInputs in class ClassificationProblem
Parameters:
inputs - input array to set
rec - record to set values from

compare

boolean[] compare(java.lang.Object[] outputs,
                  Record rec)
Determine the result of classification by comparing the evaluated outputs from our Cartsesian Genetic Program to the instance class(es) specified somewhere in the given Record.

Specified by:
compare in class ClassificationProblem
Parameters:
outputs - The output vector resulting from evaluation of the CGP.
rec - The record from which to compare classification results.
Returns:
A boolean vector indicating sucess of classification.