Advertisement

Neural nets plus Genetic algorithms

Started by February 19, 2002 04:56 PM
58 comments, last by Kylotan 22 years, 8 months ago
I may be confused by what you''re trying to say but you''re suggesting that it might be better to do evolution without crossover. Can I ask exactly what you mean by evolution then .

Cheers,

Mike
quote: Original post by fup
Once you start using GA''s you''ll realize there are countless uses for them.


PS> How do you get the hyperlinks in your sigs guys? (I do not know the mysteries of html)


Why don''t you just name some of those countless uses then?

Advertisement
I wasn''t implying GAs have no real-world uses - just that the tutorials tend to be something contrived, meaning it becomes hard to see how you would use such a thing.

I just can''t see why you''d train 2 NNs and then perform a GA crossover to improve the weights, when the same processing power could be used to train that NN for twice as long. I''m not being sceptical here, I just honestly can''t see the application, except in situations where the GA is used to approximate biological genetics (as oppposed to being used in a purely algorithmic fashion).

I don''t really grasp the ''unsupervised'' concept, I''m afraid... surely it is just a case of ''less supervised'', since you cannot generate a fitness function without some method of measuring fitness?

Oh, and I have read all the articles on alexjc and fups'' sites, so directing me there for an explanation is not going to help much

(I appreciate AI is not my forté, so please be gentle with the replies )

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Kylotan, you wouldn''t train just 2 NN with GA''s, you would evolve a whole population of NN''s.
Unsupervised means you would never (I don''t know if this is really true) know which target pattern a NN would have if it was presented with an input pattern. The actions of a NN evolved with GA almost always depends on its environment.

GA''s are called ''unsupervised'' learning, since the algorithm does not depend on example data. That doesn''t mean you can''t create some sort of fitness function. Those are two different things you have to keep in mind.
For some sort of input you would only know if the output is ''good'' or ''bad''. But you wouldn''t know what the output would be if you were only given an input. There''s a subtle difference here.

But I''m sure you will understand this if you have full understanding of both NN''s and GA''s. I knew about NN and GA''s and fully understood the concept of combining these two after reading the article about the quake neuralbot.

I hope this will clear up a thing or two.\

Edo
Edo
quote: Original post by edotorpedo
Kylotan, you wouldn''t train just 2 NN with GA''s, you would evolve a whole population of NN''s.

Ok, but that doesn''t really answer my question. For ''2'', you can substitute any number greater than one. Why have 20 bots learning and breeding when you could have one learning at 20 times the rate (given the same computational usage)? Is it to help overcome local minima or something? Or is it genuinely more efficient? Or is it made necessary, in that you can''t use an NN on its own for this?

And is there any reason why you would use GAs with NNs if you weren''t simulating a whole load of ''minds'' in this way? That was kind of what I wanted to know in the first place.

quote: But I''m sure you will understand this if you have full understanding of both NN''s and GA''s.

I have a decent understanding of NNs, I have a functional understanding of GAs (I know how to write one and how and why they work), but since I have little experience I am having trouble seeing the applicability.

I can see several places where I would use an NN, but not a GA, especially not together, except for that one case we''ve covered. I was wondering if there were others.

From reading that Neuralbot site, it seems like he was using only a tiny fraction of a neural net''s capability anyway, and doing all the learning work with the GA. Again, I am probably missing the point, but it seems like a waste.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
quote: Original post by Kylotan
Why have 20 bots learning and breeding when you could have one learning at 20 times the rate (given the same computational usage)?

That''s about population size. It''s a theoretical thing for the GA, so you can actually only have one agent, but many NN solutions within the GA''s population. Big populations have many advantages -- mostly diversity for optimal searching. Personally, I have one bot in the game, but it has a virtual NN population of 81 inside it (embedded evolution).

quote:
I have a decent understanding of NNs, I have a functional understanding of GAs (I know how to write one and how and why they work), but since I have little experience I am having trouble seeing the applicability.

Again, think of GA as an optimisation tool. No more, no less. Once you''ve modelled your problem for a NN, if you can''t get per-instance training data, define a fitness function and optimise to that (GA is one way of doing this).

quote:
From reading that Neuralbot site, it seems like he was using only a tiny fraction of a neural net''s capability anyway, and doing all the learning work with the GA. Again, I am probably missing the point, but it seems like a waste.

His model is very limited anyway: the way the inputs/outputs are chosen, the lack of modularity, lack of internal state... these are all things that limit the bot. The choice of GA is worthy (potentially allowing gas-nets), but reinforcement learning may have been better in my opinion.



Artificial Intelligence Depot - Maybe it''s not all about graphics...

Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!

Advertisement
LessBread: thanks for the sig

Anon(lol):

quote: Original post by Anonymous Poster


Why don''t you just name some of those countless uses then?



Because it didn''t add to the discussion. GAs are essentially an optimization tool. They traverse search spaces very quickly. So they can be used in most situations where you have a whole load of parameters which need tweaking. From the weights in neural nets, modelling racing lines and engine tuning in motor vehicles, protein modelling, stress calculations... honestly the list is too big.

Kylotan:
quote:
I wasn''t implying GAs have no real-world uses - just that the tutorials tend to be something contrived,


My GA tutorial is contrived because it was written solely as a prelude to the ANN tutorial. I didn''t want to spend pages on a ''real'' optimization problem because that''s what i do in the ANN tutorial and I believe the GA tutorial, though short, is adequate.

quote:
Ok, but that doesn''t really answer my question. For ''2'', you can substitute any number greater than one. Why have 20 bots learning and breeding when you could have one learning at 20 times the rate (given the same computational usage)? Is it to help overcome local minima or something? Or is it genuinely more efficient? Or is it made necessary, in that you can''t use an NN on its own for this?


Because if you don''t use a GA how are you going to train the net to do something like bot AI? You could *try* reinforcement learning but I reckon that''s going to prove fruitless except in specific cases. If you want to use a supervised method like backprop then how are you going to generate relevant training sets? If you don''t understand the distinction here then you do not understand what supervised and unsupervised learning actually mean.

I believe Alex has answered all your other queries.

I would strongly recommend coding your own GAs and ANNs because that''s the only way(unless you are very clever indeed) these concepts will ''click'' into place. Trust me, try it and it''ll answer all your questions.




Stimulate
>Why have 20 bots learning and breeding when you could have one learning at 20 times the rate (given the same computational usage)? Is it to help overcome local minima or something? Or is it genuinely more efficient? Or is it made necessary, in that you can''t use an NN on its own for this?

Consider GA as being a method of space traversal. For simplicity, let us assume the NN''s are single perceptrons. Therefore the space the GA would be traversing is the space of all weight vectors. So you''re asking why shouldn''t we have 20 initial populations as opposed to one and run the latter 20 times longer? Well imagine yourself on a mountain range. Since there are several peaks it would take one person a very long time to find the tallest of them all, if you could at all (maybe throw in random restarts). Now imagine yourself on a mountain range with 19 friends. The group would have a better chance of finding the highest peak since while some people would get stuck on lower peaks, other could continue on.

>I just can''t see why you''d train 2 NNs and then perform a GA crossover to improve the weights, when the same processing power could be used to train that NN for twice as long.

The assumption made here is that a combination of the current best leads to the overall best, though I don''t beleive this assumption can be made as a general rule. It would be highly dependant on the space you were traversing. In the mountain range example is assumes the highest peak is "inbetween" two other peaks, which obviously isn''t always true. This assumption can, and is, made inside the population though. The population is assumed to span a relatively small portion of the space and doesn''t represent two unrelated maxima.
quote: Original post by fup
My GA tutorial is contrived because it was written solely as a prelude to the ANN tutorial. I didn''t want to spend pages on a ''real'' optimization problem because that''s what i do in the ANN tutorial and I believe the GA tutorial, though short, is adequate.

Okay. I don''t mean to criticise your tutorial at all, as it''s very good and helpful. I guess I am just not very good at learning things unless I see a practical application, and mixing it with the NN stuff kind of blurred it for me personally.

quote: Because if you don''t use a GA how are you going to train the net to do something like bot AI? You could *try* reinforcement learning but I reckon that''s going to prove fruitless except in specific cases.

I''ll let you and Alex debate the merits of that

quote: If you want to use a supervised method like backprop then how are you going to generate relevant training sets? If you don''t understand the distinction here then you do not understand what supervised and unsupervised learning actually mean.

Ok, so GAs are good in situations where you have no training set for a NN (eg. learning to shoot at enemies who will appear randomly) but can still evaluate the ''fitness'' (eg. how often you hit, how much you miss by)?

quote: I would strongly recommend coding your own GAs and ANNs because that''s the only way(unless you are very clever indeed) these concepts will ''click'' into place. Trust me, try it and it''ll answer all your questions.

Yeah - I just need to find uses for them, that''s all. (And hence this entire thread ) Any vague ideas on how I could leverage either or both of them into a text-only MUD?

Thanks to all for your responses, by the way.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
quote: Original post by Kylotan
Ok, so GAs are good in situations where you have no training set for a NN (eg. learning to shoot at enemies who will appear randomly) but can still evaluate the ''fitness'' (eg. how often you hit, how much you miss by)?


What you basically just did was explain the difference between supervised and unsupervised learning in the form of a question. GAs are unsupervised; hence they require no training data. Supervised training methods like backprop require training data. In short, you''ve hit the nail on the head.

As for real-life applications, I''ll be honoest; I haven''t tried to find any. The problem for me is that the architecture of an NN seems altogether too arbitrary. The architecture of an NN is dependent upon the application. If you don''t understand the application beyond a simple fitness function, It seems that you''re basically just hoping that the architecture you decided upon can classify things accurately. You can''t use a Perception to solve XOR. But if you didn''t know the answers to the XOR problem, and could only say "right" or "wrong" for a given output (as a fitness function does), then how would you know that it isn''t linearly seperable and therefore cannot be solved by a perception? If you design a 2-layer neural net to control your quake bot and know nothing more than whether it lives or dies, how do you know if your architecture is capable of solving the problem? These are my questions, and I can''t seem to solve them. The answer lies in evolving the architecture as well - and this is getting a bit over my head!!

This topic is closed to new replies.

Advertisement