# Bug in ParameterIteration?

Member Posts: 3 Contributor I
edited November 2018 in Help
Hi there,

I think there is a bug in ParameterIteration. When I use logarithmic scaling I get the following results:
Min = 2, Max = 8, Steps = 2 gives 2, 3.646, 8 where I’d expect 2, 4, 8
Min = 0.125, Max = 1, Steps = 3 gives 0.125, 0.358, 0.646, 1 where I’d expect 0.125, 0.25, 0.5, 1

This is the code producing the sequence:
`package com.rapidminer.parameter.value. ParameterValueGrid…private double[] scaleLogarithmic(int steps) {		double[] values = new double[steps + 1];		double offset = 1 - min;		for (int i = 0; i < steps + 1; i++) {			values = Math.pow(max + offset, (double) i / (double) steps) - offset;		}		return values;	}`
Here, the distance between the individual values is independent of the position of the interval. I think that’s wrong. This is the fix I propose:
`private double[] scaleLogarithmic(int steps) {		double[] values = new double[steps + 1];		double factor = 1 / min; //TODO: Make sure min > 0		for (int i = 0; i < steps + 1; i++) {			values = Math.pow(max * factor, (double) i / (double) steps) / factor;		}		return values;	}`
Regards,
Peter
Tagged:

• Moderator, Employee, Member Posts: 290 RM Product Management
Hi Peter,

thank you for reporting this. Your solution indeed gives a lot more plausible values than the existing implementation. I will integrate the code lines you proposed into the code of RapidMiner. It will be available with the next release of RapidMiner 5 which is about to come very soon.

Thanks again!

Best regards,
Tobias
• Member Posts: 3 Contributor I
Hi Tobias,

that’s great, thank you. However, in my solution, you can’t set Min = 0. Although that is quite right for logarithmic scaling (as Min approaches 0, all the grid points should approach 0), the user might want to select 0 in addition to the true logarithmic values. That is a quite common situation, as 0 has a special meaning for some operators.
Maybe you want to add a check box “Add 0 to value list” as a remedy.

Of course, you can always enter the value list manually, but that can be a bit awkward.

Regards,
Peter