Skip to content

MutatePerturb.performOperation calculation is not correct #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
konical opened this issue Aug 9, 2013 · 2 comments
Closed

MutatePerturb.performOperation calculation is not correct #148

konical opened this issue Aug 9, 2013 · 2 comments
Milestone

Comments

@konical
Copy link

konical commented Aug 9, 2013

In org.encog.ml.genetic.mutate.MutatePerturb.performOperation():

As written this line will not work for small values.
value += (perturbAmount - (rnd.nextDouble() * perturbAmount * 2));

It should be changed to:
value += value * (perturbAmount - (rnd.nextDouble() * perturbAmount * 2));

Examples:
using perturbAmount = 0.2
and random perturbation = ( (perturbAmount - (rnd.nextDouble() * perturbAmount * 2)) )
= -0.1424

using encog calculation -
value = 15, perturbation % = -0.842%, new value = 14.87
value = 0.001, perturbation % = -8771%, new value = -0.086713711

VALUE FOR SMALL NUMBER IS PERTURBED BY ~9000% !

using changed code:
value = 15, perturbation % = -14.24%, new value = 12.86
value = 0.001, perturbation % =-14.24%, new value = 0.000857636

Value for small number is perturbed by the requested amount.

@konical konical closed this as completed Aug 9, 2013
@konical konical reopened this Aug 9, 2013
@jeffheaton
Copy link
Owner

Thanks good point. I will add this soon.

@jeffheaton
Copy link
Owner

Thank you good fix. I have this in the code now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants