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
Maximization isted of minimization #211
Comments
You must use axis=0 when registering numpy stats operators. It should get you a better insight. Otherwise, your code look fine to me and there is no bug on that aspect in DEAP. |
I used axis = 0 but it doesn't help. I need to use SelRoulette for my program but it still going for maximization, no matter if i put in weights 1.0 or -1.0 or use FitnessMin or FitnessMax. When i use SelTournament, tournsize = 3 i can change weights and it's maximization for 1.0 and minimization for -1.0. Why it doesnt work with SelRoulette ? What can i do to achive minimization and use SelRoulette? @fmder |
Ho yeah, roulette selection cannot be used for minimizing has it cannot
handle negative numbers.
Le 17 juin 2017 07:07, "GrzegorzGiniewicz" <notifications@github.com> a
écrit :
… I used axis = 0 but it doesn't help. I need to use SelRoulette for my
program but it still going for maximization, no matter if i put in weights
1.0 or -1.0 or use FitnessMin or FitnessMax. When i use SelTournament,
tournsize = 3 i can change weights and it's maximization for 1.0 and
minimization for -1.0. Why it doesnt work with SelRoulette ? What can i do
to achive minimization and use SelRoulette?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#211 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA6rwsjyszBQbETVoF5VVi0qphqACa8Iks5sE7NVgaJpZM4N8SpT>
.
|
Thanks for quick answer and sorry for trouble. |
Maybe you can try #87, if it works you could propose a pull request. |
I've changed selection for SelBest but i cant set k= 20 [like this: (toolbox.register("select", tools.selBest, k=20) ] im geting error: "selBest" got multiple values for keyword argument 'k'. And still its maximizing, even with : I understand that k is for the number of individuals to select.
|
In eaSimple, selection is made to replace the whole population with |
If you want to customize selection with multiple operators I'd say you should copy the content of eaSimple in your own script and replace the selection part, you'll be able to get exactly what you want really easily. The content of eaSimple is no more than 30 lines of code. |
ok i changed k for 20 but still it's maximizing. How i can achive minimization ? @fmder
|
How do you see that it is maximizing? |
im printing results : Its wird that its not working, when i use selTournament it's fine . Buy i rly need selBest |
I just tested your script. I just saw that the "best" you are printing is the average of all fitnesses. What you really should look for is the min value. Add those lines to your script stats.register("min", numpy.min, axis=0)
stats.register("max", numpy.max, axis=0)
stats.register("avg", numpy.average, axis=0) You'll see that the min value starts around 7 or so and goes to 0 in about 5 to 10 generations. Why does it go up again? It is because of the And variation operator and your high crossover and mutation rate. The evaluation is done after variation and before selection thus you might modify the best individuals. However by using a hall of fame you will still capture it. With high crossover rate it is possible for the max value to go up and the min value to go down averaging the optimisation result over the entire population, exactly what you are observing. Essentially you should just check for the min value. |
Thank you very much for help and patiance. |
:)
2017-06-17 10:07 GMT-04:00 GrzegorzGiniewicz <notifications@github.com>:
… Thank you very much for help and patiance.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#211 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA6rwqe-pw-RRN0ghodUB_HtUhHqYOmFks5sE929gaJpZM4N8SpT>
.
|
Hi.
i have problem with minimization of ackley benchmark function. I cant achieve minimization.
im using
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, typecode='d', fitness=creator.FitnessMin)
Im loking for help on stackoveflow. There is my code. Link:
https://stackoverflow.com/questions/44576799/minimize-a-function-using-deap
The text was updated successfully, but these errors were encountered: