The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Bug in RouletteWheel.java?"
Not sure whether anyone else encountered this problem when using GeneticAlgorithm operator. When using selection_scheme="roulette wheel", sometimes I will encounter the following:
BTW, if you want to create this error, just need to use the following process XML
Exception: com.rapidminer.operator.UserErrorI have attempted to trace the problem and I realized that if my main_criterion for my RegressionPerformance operator is root_mean_square_error, I will encounter this problem. But if I change it to squared_correlation, the problem disappears. It seems that the offending piece of code is as follow:
Message: Generation exception: 'java.lang.IndexOutOfBoundsException: Index: 5, Size: 5'
Stack trace:
com.rapidminer.operator.features.FeatureOperator.applyOpList(FeatureOperator.java:413)
com.rapidminer.operator.features.FeatureOperator.apply(FeatureOperator.java:330)
com.rapidminer.operator.Operator.apply(Operator.java:666)
com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:416)
com.rapidminer.operator.Operator.apply(Operator.java:666)
com.rapidminer.Process.run(Process.java:695)
com.rapidminer.Process.run(Process.java:665)
com.rapidminer.Process.run(Process.java:655)
com.rapidminer.gui.ProcessThread.run(ProcessThread.java:61)
Cause
Exception: java.lang.IndexOutOfBoundsException
Message: Index: 5, Size: 5
Stack trace:
java.util.ArrayList.RangeCheck(ArrayList.java:547)
java.util.ArrayList.get(ArrayList.java:322)
com.rapidminer.operator.features.Population.get(Population.java:104)
com.rapidminer.operator.features.selection.RouletteWheel.operate(RouletteWheel.java:88)
com.rapidminer.operator.features.FeatureOperator.applyOpList(FeatureOperator.java:406)
com.rapidminer.operator.features.FeatureOperator.apply(FeatureOperator.java:330)
com.rapidminer.operator.Operator.apply(Operator.java:666)
com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:416)
com.rapidminer.operator.Operator.apply(Operator.java:666)
com.rapidminer.Process.run(Process.java:695)
com.rapidminer.Process.run(Process.java:665)
com.rapidminer.Process.run(Process.java:655)
com.rapidminer.gui.ProcessThread.run(ProcessThread.java:61)
while (newGeneration.size() < popSize) {Theoretically, f will be lesser than r before j exceeds with number of individuals in population. However, it seems like this assumption will break down once in a while. Not very sure why this happens. Does anyone knows why and is this a bug?
double r = fitnessSum * random.nextDouble();
int j = 0;
double f = 0;
Individual individual = null;
do {
individual = population.get(j++);
f += filterFitness(individual.getPerformance().getMainCriterion().getFitness());
} while (f < r);
newGeneration.add(individual);
}
BTW, if you want to create this error, just need to use the following process XML
<operator name="Root" class="Process" expanded="yes">
<description text="This process is very similar to the previous process. Again, a cross validation building block is used as fitness evaluation. In this case, a genetic algortihm for feature selection is used. This process demonstrates two other features of the feature operators of RapidMiner: the stop button which allows the abort of the process if the user was already satisfied and the ProcessLog operator which allows online plotting of current fitness values. Please refer to the visualisation sample processes and the RapidMiner operator reference for further details."/>
<parameter key="random_seed" value="1976"/>
<operator name="ExampleSetGenerator" class="ExampleSetGenerator">
<parameter key="target_function" value="sum"/>
<parameter key="number_examples" value="200"/>
<parameter key="number_of_attributes" value="4"/>
<parameter key="attributes_lower_bound" value="0.0"/>
</operator>
<operator name="NoiseGenerator" class="NoiseGenerator">
<parameter key="random_attributes" value="8"/>
<parameter key="label_noise" value="0.0010"/>
<list key="noise">
</list>
</operator>
<operator name="GeneticAlgorithm" class="GeneticAlgorithm" expanded="yes">
<parameter key="show_stop_dialog" value="true"/>
<parameter key="population_size" value="6"/>
<parameter key="maximum_number_of_generations" value="12"/>
<parameter key="selection_scheme" value="roulette wheel"/>
<operator name="OperatorChain" class="OperatorChain" expanded="yes">
<operator name="XValidation" class="XValidation" expanded="yes">
<parameter key="sampling_type" value="shuffled sampling"/>
<operator name="LinearRegression" class="LinearRegression">
<parameter key="feature_selection" value="none"/>
</operator>
<operator name="OperatorChain (2)" class="OperatorChain" expanded="yes">
<operator name="ModelApplier" class="ModelApplier">
<list key="application_parameters">
</list>
</operator>
<operator name="RegressionPerformance" class="RegressionPerformance">
<parameter key="main_criterion" value="root_mean_squared_error"/>
<parameter key="root_mean_squared_error" value="true"/>
<parameter key="root_relative_squared_error" value="true"/>
</operator>
</operator>
</operator>
<operator name="ProcessLog" class="ProcessLog">
<list key="log">
<parameter key="gen" value="operator.GeneticAlgorithm.value.generation"/>
<parameter key="perf" value="operator.GeneticAlgorithm.value.performance"/>
<parameter key="best" value="operator.GeneticAlgorithm.value.best"/>
</list>
</operator>
</operator>
</operator>
</operator>
Tagged:
0
Answers
thanks for the clear and rich description. We will have a look into this and post back as soon as possible.
Cheers,
Ingo
this bug is fixed now. Thanks again for sending the rich description which was really helpful.
Cheers,
Ingo
Cheers.