What's the importance of invalid fitness in DEAP?

207 views
Skip to first unread message

Zhida Deng

unread,
Jun 22, 2017, 3:50:42 PM6/22/17
to deap-users

I am just starting use DEAP. Previously, I used GA based on Matlab that after crossover and mutation is to select the better individuals with specified size, and then updating the population. But it is quite hard for me to understand that why in DEAP the evaluate the individuals with an invalid fitness is needed after the crossover and mutation procedure:

invalid_ind = [ind for ind in offspring if not ind.fitness.valid]
fitnesses = map(toolbox.evaluate, invalid_ind)
for ind, fit in zip(invalid_ind, fitnesses):
    ind.fitness.values = fit

I tried that deleting those code, but it seems the algorithm will never convergence. And even I did't see those can updating the population/offspring, so what are those use for. Many thanks in advance!!!

François-Michel De Rainville

unread,
Jun 22, 2017, 5:21:30 PM6/22/17
to deap-users
It is only to save processing. It should still converge without it. Male sure you are evaluating the right list of individuals.

--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zhida Deng

unread,
Jun 22, 2017, 5:32:28 PM6/22/17
to deap-...@googlegroups.com

Dear Francois,

 

Many thanks for the replying. For example, It will convergent after 20 generations with those code, but it converging after more than 20000 generations without those code.

 

So it may not only save the processing, but also updating the population/offspring?

 

Best Regards,

Zhida

 

发件人: François-Michel De Rainville
发送时间: 2017622 22:21
收件人: deap-users
主题: Re: [deap-users] What's the importance of invalid fitness in DEAP?

 

To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/_M2lKIQT4LE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to deap-users+...@googlegroups.com.

François-Michel De Rainville

unread,
Jun 22, 2017, 5:34:10 PM6/22/17
to deap-users
You still have to do evaluation, you can only skip filtering on not valid individuals.

Le 22 juin 2017 5:32 PM, "Zhida Deng" <z.deng...@gmail.com> a écrit :

Dear Francois,

 

Many thanks for the replying. For example, It will convergent after 20 generations with those code, but it converging after more than 20000 generations without those code.

 

So it may not only save the processing, but also updating the population/offspring?

 

Best Regards,

Zhida

 

发件人: François-Michel De Rainville
发送时间: 2017622 22:21
收件人: deap-users
主题: Re: [deap-users] What's the importance of invalid fitness in DEAP?

 

It is only to save processing. It should still converge without it. Male sure you are evaluating the right list of individuals.

Le 22 juin 2017 3:50 PM, "Zhida Deng" <z.deng...@gmail.com> a écrit :

I am just starting use DEAP. Previously, I used GA based on Matlab that after crossover and mutation is to select the better individuals with specified size, and then updating the population. But it is quite hard for me to understand that why in DEAP the evaluate the individuals with an invalid fitness is needed after the crossover and mutation procedure:

invalid_ind = [ind for ind in offspring if not ind.fitness.valid]
fitnesses = map(toolbox.evaluate, invalid_ind)
for ind, fit in zip(invalid_ind, fitnesses):
    ind.fitness.values = fit

I tried that deleting those code, but it seems the algorithm will never convergence. And even I did't see those can updating the population/offspring, so what are those use for. Many thanks in advance!!!

--
You received this message because you are subscribed to the Google Groups "deap-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/_M2lKIQT4LE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to deap-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.

Zhida Deng

unread,
Jun 22, 2017, 5:38:28 PM6/22/17
to deap-...@googlegroups.com

It means If I skipped filtering on not valid individuals, I need to write another codes for selecting individuals for evaluation?

 

Best Regards,

Zhida

 

 

发件人: François-Michel De Rainville
发送时间: 2017622 22:34
收件人: deap-users
主题: Re: 答复: [deap-users] What's the importance of invalid fitness in DEAP?

 

You still have to do evaluation, you can only skip filtering on not valid individuals.

Le 22 juin 2017 5:32 PM, "Zhida Deng" <z.deng...@gmail.com> a écrit :

Dear Francois,

 

Many thanks for the replying. For example, It will convergent after 20 generations with those code, but it converging after more than 20000 generations without those code.

 

So it may not only save the processing, but also updating the population/offspring?

 

Best Regards,

Zhida

 

发件人: François-Michel De Rainville
发送时间: 2017622 22:21
收件人: deap-users
主题: Re: [deap-users] What's the importance of invalid fitness in DEAP?

 

It is only to save processing. It should still converge without it. Male sure you are evaluating the right list of individuals.

Le 22 juin 2017 3:50 PM, "Zhida Deng" <z.deng...@gmail.com> a écrit :

I am just starting use DEAP. Previously, I used GA based on Matlab that after crossover and mutation is to select the better individuals with specified size, and then updating the population. But it is quite hard for me to understand that why in DEAP the evaluate the individuals with an invalid fitness is needed after the crossover and mutation procedure:

invalid_ind = [ind for ind in offspring if not ind.fitness.valid]
fitnesses = map(toolbox.evaluate, invalid_ind)
for ind, fit in zip(invalid_ind, fitnesses):
    ind.fitness.values = fit

I tried that deleting those code, but it seems the algorithm will never convergence. And even I did't see those can updating the population/offspring, so what are those use for. Many thanks in advance!!!

--
You received this message because you are subscribed to the Google Groups "deap-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/_M2lKIQT4LE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to deap-users+...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "deap-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/_M2lKIQT4LE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to deap-users+...@googlegroups.com.

François-Michel De Rainville

unread,
Jun 22, 2017, 7:31:29 PM6/22/17
to deap-users
You will have to write this

fitnesses = map(toolbox.evaluate, offspring)
for ind, fit in zip(offspring, fitnesses):
    ind.fitness.values = fit

To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/_M2lKIQT4LE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to deap-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "deap-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/_M2lKIQT4LE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to deap-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.

Zhida Deng

unread,
Jun 22, 2017, 8:00:17 PM6/22/17
to deap-...@googlegroups.com
Many many thanks for your help and patience, and now I knew the reasons. 

Best Regards,
Zhida

To unsubscribe from this group and all its topics, send an email to deap-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages