## RE: {Disarmed} Re: [GP] Evolution of Neural Networks

Expand Messages
• Paros, You don t say what resolution image you re trying to fit. For hi-res images, it s very hard to do this with MLPs (or NEAT, for that matter), but more
Message 1 of 32 , Mar 8, 2008
Paros,

You don't say what resolution image you're trying to

fit. For hi-res images, it's very hard to do this with MLPs (or NEAT,
for that matter),

but more straightforward to do with other representations.

E.g. if you set up a radial basis function network in the right way,

you can eliminate local minima and make it relatively easy to solve.

Or of course you could just use a block DCT (like JPEG), and fit it
directly (this was

not what you're trying to do, I'm just pointing out that you can make
this

as easy or hard as you like...). Also, better to experiment with
monochrome images

to begin with.

Best wishes,

Simon Lucas

ps. for this, it's useful to play with simple 2d functions to fit, such
as the spiral below,

and see how well you can fit it as you increase "turns"

public class SpiralFunc {

int turns = 16;

int turnRate = 1;

public double f(double x, double y) {

x = x - 0.5;

y = y - 0.5;

double r = Math.sqrt(x*x + y *y);

double theta = Math.atan2(y, x);

return Math.sin(turnRate * theta + r * Math.PI * turns);

}

}

From: genetic_programming@yahoogroups.com
[mailto:genetic_programming@yahoogroups.com] On Behalf Of A W
Sent: 08 March 2008 18:38
To: genetic_programming@yahoogroups.com
Subject: {Disarmed} Re: [GP] Evolution of Neural Networks

I'll start with a question. you said you used a fitness test of
euclidean distance in
RGB values. This would instinctively be my first choice, What problems
did you
encounter with this?
As far as escaping local maximum, Here a few things to try. {I admit
that i'm speculating here}

-Maintain several independent populations. Only after a large number of
generations, allow crossover
to occur between the populations once, then repeat. After a population
to population crossover,
dump the least fit population and start from scratch with that pop.

-Keep the mutation rate low, 1 or 2% and retain 1/3 or so of a
population to be random.

-Your input of the x,y vector may just not contain enough info. Maybe
try adding a third input with
something relative to the problem (color delta of x-1,y-1 ect).

-Split one or more of your hidden layers into 1/3's, 1 bound to each
output to possibly help
localize on that desired color.

Does your network perform better if you reduce the search to only one
color?

Aaron.

----- Original Message ----
From: paros <paris_o_o@... <mailto:paris_o_o%40yahoo.com> >
To: genetic_programming@yahoogroups.com
<mailto:genetic_programming%40yahoogroups.com>
Sent: Friday, March 7, 2008 21:13:29
Subject: [GP] Evolution of Neural Networks

I have recently been experimenting with a genetic algorithm to evolve
multi-layer perceptrons to produce a particular output.

The protoype output is just an image file read in from disk. Weeks
ago I thought this would be easy-as-pie and the GA would easily find a
network that produces the image as closely as possible. In fact, I
only wanted to create this little experiment to ensure that my neural
network code was correct and "robust".

I completely misjudged this project! I have been through a
roller-coaster ride of agony trying to get this to work. I have had
to write and re-write and formulate and reformulate the fitness metric
for when two images are "close to each other". I *finally* have a
good one after a week of solid headache. But I'm still not so sure if
it's the best I could be using.

(>) The multi-layer perceptron has an input vector of dimension two.
Each input corresponds to a 2D coordinate on the image.

(>) It has two hidden layers of 24 and 32 nodes respectfully.

(>) The output is 3 nodes. Where each node is Red, Green, and Blue
respectfully.

I would have to write a short story to describe all the different
metrics I used for measuring fitness of a candidate image/network. (I
did HSV metrics. Number of pixels that are exactly correct. Uhm..
euclidean distance in an RGB cube. All sorts of stuff that I will not
get into here at this time.) In addition to this headache, I have
also had very difficult time stopping the evolutionary process from
getting stuck in a local maximum. I have tried numerous methods.
I'm not going to cover all of them here (that failed). I will only
list some ideas that appear to be working.

(>) After crossover, if the image has lower fitness than its parents,

(>) After mutation only, if the image has lower fitness than it's
previous incarnation, that mutant is discarded.

(>) The above two methods makes evolution get out of early local
maximums, but not out of later ones. (ugh! here we go again!)

(>) So in order to combat the above problem of the population
dominated by regime of similar organisms, I have introduced something
called a High-Mutation Group. Members of this group are called "High
Mutants" and as my program runs the number of active high mutants is
displayed. High mutants are created when the algorithm stumbles upon
an organism of very low fitness (relative to the population of
course). It is replaced by a totally random organism (as if we are
starting over). This random organism is not discarded no matter what
its fitness. So High Mutants all get a free ticket into the next
generation. Mutation itself is too slow to get a population knocked
out of a local maximum. The hope is that this pool of highly
randomized mutants will get crossed with a regime member and maybe
just maybe it will knock the population out its stuck spot.

To summarize the agony I have been through in the last few days, the
essential struggle is that you don't want mutation to be so high that
it DESTROYS high-fitness candidates in your population. But
similarly, if you HOLD ON TO high-fitness candidates too much, then
your population eventually becomes dominated by them and your
population gets stuck in a fascist regime of the same organism and all
its children.

I don't know how to balance these two competing interests. And it's
like if I give up early stuck spots, I only inherit later ones and
vice-versa.

It's frustrating. It really is.

Can anyone in this yahoo group provide me links to publications or the
like where someone has tried to evolve networks in this manner? Thank

<!--

#ygrp-mkp{
14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10p
x 0px;}
margin-bottom:10px;}
color:#0000ff;text-decoration:none;}
-->

<!--

font-family:Arial;}
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
-->

<!--

#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean,
sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean,
sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
#ygrp-vitnav a{
#ygrp-actbar{
clear:both;margin:25px
0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
}
#ygrp-mlmsg #logo{

#ygrp-vital{
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-trans
form:uppercase;}
#ygrp-vital ul{
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;pa
dding-right:.5em;}
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

color:#999;font-size:77%;}
text-decoration:none;font-size:130%;}
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-hei
ght:122%;}
text-decoration:none;}
text-decoration:underline;}
margin:0;}
o{font-size:0;}
.MsoNormal{
margin:0 0 0 0;}
#ygrp-text tt{
font-size:120%;}
blockquote{margin:0 0 0 4px;}
.replbq{margin:4;}
-->

Send instant messages to your online friends
http://uk.messenger.yahoo.com

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]
• I still suspect that the net does have enough information in the inputs to provide the proper output. perhaps try adding an extra input that s related to the
Message 32 of 32 , Mar 17, 2008
I still suspect that the net does have enough information in the inputs to provide the proper output.
perhaps try adding an extra input that's related to the desired out such as an index to the primary color etc and see how they perform with your current training method.

----- Original Message ----
From: paros <paris_o_o@...>
To: genetic_programming@yahoogroups.com
Sent: Monday, March 17, 2008 7:16:22
Subject: [GP] Re: Evolution of Neural Networks

No actually I'm convinced this fitness metric is good. The problem
I'm having is one of lack of diversity at the ends of evolution runs.
The average population fitness hovers around 60 to 75% and doesn't
go anywhere for 8 hours or more. This is after an explosion in
fitness in the first hour. It is now totally obvious to me that the
process is getting caught in a local maximum, and I have no idea how
to bump it out.

--- In genetic_programming @yahoogroups. com, John Bäckstrand
<sandos@...> wrote:
>
> paros wrote:
> > The problem is that I'm not getting that. I'm getting dirty tricks
> > where evolution ignores difficult parts of the image and just banks on
> > large swaths of color for quick-and-dirty gains on lots of pixels.
> > Evolution is trying to maximize fitness and is doing so in whatever
> > underhanded manner it can find. Please see my other posts on this
> > forum for a screenshot of the results so far.
>
> That is neither underhanded nor a trick: You have simply not defined
> fitness properly, if fit individuals do not please you.
>
> ---
> John Bäckstrand
>

<!--

#ygrp-mkp{
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
margin-bottom:10px;}
color:#0000ff;text-decoration:none;}
-->

<!--

font-family:Arial;}
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
-->

<!--

#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
#ygrp-vitnav a{
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
}
#ygrp-mlmsg #logo{

#ygrp-reco {
font-weight:bold;color:#ff7900;}

#reco-grpname{
font-weight:bold;margin-top:10px;}
#reco-category{
font-size:77%;}
#reco-desc{
font-size:77%;}

#ygrp-vital{
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

color:#999;font-size:77%;}
text-decoration:none;font-size:130%;}
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
text-decoration:none;}
text-decoration:underline;}
margin:0;}
o{font-size:0;}
.MsoNormal{
margin:0 0 0 0;}
#ygrp-text tt{
font-size:120%;}
blockquote{margin:0 0 0 4px;}
.replbq{margin:4;}
-->

Send instant messages to your online friends http://uk.messenger.yahoo.com

[Non-text portions of this message have been removed]
Your message has been successfully submitted and would be delivered to recipients shortly.