Information Technology Reference
In-Depth Information
designed using the first approach (let's call it the three-step approach), which
classifies correctly 149 out of 150 sample cases.
Although this model was not created by Gepsoft APS, we can still use this
software to automatically translate the Karva code of each sub-model into a
conventional programming language. So, the first sub-model encoded in chro-
mosome (4.16), which is responsible for the classification of the setosa vari-
ety, is translated into the following C++ function:
int apsModel(double d[])
{
const double ROUNDING_THRESHOLD = 0.5;
double dblTemp = 0.0;
dblTemp = (d[1]-d[2]);
return (dblTemp >= ROUNDING_THRESHOLD ? 1:0);
}
(4.17)
And as was discovered with the three-step approach, only the difference
between the sepal width and the petal length is relevant to distinguish Iris
setosa from the other two irises.
The identification of the versicolor variety was carried out by the second
sub-model of program (4.16). In fact, this sub-model is the worst of the three
sub-models, being able to classify correctly just 148 plants. More specifi-
cally, it failed to classify samples 73 and 84 (recall that the model created
with the three-step approach was also unable to classify sample 84). Its ex-
pression is shown below:
int apsModel(double d[])
{
const double ROUNDING_THRESHOLD = 0.5;
double dblTemp = 0.0;
dblTemp = ((((d[0]-d[3])*d[2])/(d[1]+d[3]))/
((d[2]-d[1])*d[2]));
return (dblTemp >= ROUNDING_THRESHOLD ? 1:0);
}
(4.18)
And finally, the third sub-model is responsible for the identification of the
virginica variety. It distinguishes perfectly a total of 149 plants and fails only
to classify sample 84. Its code is shown below:
Search WWH ::




Custom Search