I'm trying to implement 10-fold cross validation in a GP classifier.
I need to train and test 10 times with different partitions of the data.
But when I try to run for the 2nd time Evolve.make, it returns a fatal
error.
It looks like since it's a static method, it is saving in its memory all the
data read from the parameters file.
Is there any option to restart the Evolutionary machine from zero?
Am I doing something wrong?
This is the sample code using the regression example.
package ec.app.classification.family;
import ec.*;
public class Testing
{
public static void main(String[] args)
{
String paramFileName = "ec/app/regression/erc.params";
EvolutionState state = ec.Evolve.make(new String[] {"-file",
paramFileName});
try {
state.run(EvolutionState.C_STARTED_FRESH);
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}
EvolutionState state2 = ec.Evolve.make(new String[]
{"-file", paramFileName});
try {
state2.run(EvolutionState.C_STARTED_FRESH);
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}
}
}
And the output:
---------- java ----------
| ECJ
| An evolutionary computation system (version 10)
| Copyright 2003 by Sean Luke
| URL: http://www.cs.umd.edu/projects/plus/ec/ecj/
| Mail: [log in to unmask]
| Date: January 1, 2003
| Current Java: 1.4.2_03 / Java HotSpot(TM) Client VM-1.4.2_03-b02
| Suggested Minimum Java: 1.2.2
| Required Minimum Java: 1.1
Setting up
Processing GP Types
Processing GP Node Constraints
Processing GP Function Sets
Processing GP Tree Constraints
{0.9994835008057914,3.9948376750832253},
.....
{0.4277701109521461,0.7225182028217614},
{0.3985343905631442,0.6458899940023977},
Initializing Generation 0
Generation 1
Generation 2
...
Generation 50
| ECJ
| An evolutionary computation system (version 10)
| Copyright 2003 by Sean Luke
| URL: http://www.cs.umd.edu/projects/plus/ec/ecj/
| Mail: [log in to unmask]
| Date: January 1, 2003
| Current Java: 1.4.2_03 / Java HotSpot(TM) Client VM-1.4.2_03-b02
| Suggested Minimum Java: 1.2.2
| Required Minimum Java: 1.1
Setting up
Processing GP Types
FATAL ERROR:
The GP type "nil" has been defined multiple times.
PARAMETER: gp.type.a.0.name
Output completed (6 sec consumed) - Normal Termination
Also tried with:
EvolutionState state = ec.Evolve.make(new String[] {"-file",
paramFileName, "-p","-nostore=true"});
Is that correct?
|