Genetic Algorithm from Scratch in Python -- Full Walkthrough

preview_player
Показать описание
This is a response to a question I got about how the genetic algorithm works... so I took a Saturday morning and just coded one up from scratch.

Feel free to have a look!!!
Рекомендации по теме
Комментарии
Автор

Awesome!

I'll adapt your code so that I can use it in a Machine Learning class in my college.
I won't forget to give you the credits, it helped me a lot.

Tkx!

DimitriLeandro
Автор

YOU are the best on teaching this topic.

chuckstarwar
Автор

That was kinda cool. And did not mention Genome once !
I was a bit puzzled by some of the seaborne and style of code. But I have played around a bit from your jupyter download to understand some more parts of the code. Thanks so much for sharing.
I did note once problem, in that the initialise code, could potentially set up none possible solutions, especially for much smaller maps. (e.g. No Paths from a Node, as probability of a value falls below p_zero threshold.) So may need a fudge that there is at least one path from each node, within initialise_map regardless of p_zero ? - at least from my quick 15 minutes of play.

juleswombat
Автор

I was looking through the map matrix, not sure if it was mentioned or not but theres one point i dont quite get. Lets say, its a 2 by 2 matrix. Row 1 Col 1 reads say 26 and Row 1 Col 2 reads 67. I understand that the respective nodes to go from point A(row 1) to point B(col 2) is 67. However, Row 1 Col 1 reads 26 despite pointing towards the same place and having no arcs. Should it be 0 instead of 67?

scottk
Автор

Thank you for this. I like the idea of a grid on connections as this could be a grid of actions/choices for a character in a game ie you cant build army without a barracks so kinda of a tier control thing. Also it would be interesting to instead of random map - draw a circle as we can visually see the optimal route that way. Cheers thanks again.

benben
Автор

Any chance you make another one of these videos with a different example? I follow pretty well except for the map generation and navigation

ice-qfvz
Автор

Amazing tutorial! The 'mutate' method is buggy though. As far I could see and test, the "mutated" route is nothing but the original input route with an additional random element appended to it, which makes it senseless, since once you reach the final node, the route should be completed.

juane.gonzalez
Автор

Thank you so much for this. Crystal clear explanation and you made the code available too! Cheers

viperaputakeyteaparyou
Автор

Is this like Travelling Salesman Problem?

RaKUen
Автор

awsome video ... but try to increase font size so that code is visible even in low res

khalidacid
Автор

I'm getting this error :
FileNotFoundError: [Errno 2] No such file or directory: 'images/new1000plot_0.png'
I created the image folder. Now where do i get this image from?

curiously-cinnamon
Автор

Hi I was wondering if you could help me with an optimization process based on the granulometric size of minerals, I’m finishing my ChemE degree and this is my final work, thanks!

SrJose
Автор

Thank you sop much brother for making the video and it, s totally helpful.

MasudRana-cplk
Автор

Can I have the python code using genetic algorithm for finding shortest path...
Please sir... Please...

Past 3 months I'm trying but no use...

Please help me sir

harikhakumaravel
Автор

This video was very helpful. Thanks a lot. I am curious about solving any benchmark problems in cultural algorithms. If you could have a tutorial about that in later videos it will be great.

ramyaravichandran
Автор

Great work! I am just curious, did you choose this problem just for the sake of explaining it? As far as I know, Dijkstra algorithm can find the shortest path in just a few milliseconds even for a network (map) size like this (1000 nodes). It might be interesting to see if GA will outperform Dijkstra for a very big network size.

mohammadw
Автор

hi Greg, thank you for posting this. I was interested in knowing if you done comparisons with genetic algorithms and convolutional neural networks or recurrent neural networks for performance and 'best solutions'. Also, is it probable that a potential solution that is terminated early in simulation ultimately may be superior to any future generations? Lastly, you mentioned at 9:00 about 'good' solutions versus 'best' solutions. Isn't the point to produce the best?

Albert-fejx
Автор

Is there any particular reason you wrote this in more of a functional programming style rather than OO? Is there some advantage to that approach for this sort of algorithm, or is that just the style you're used to?

MarkovChains
Автор

How would you modify this code to help generate a timetable? - Is it possible?

suzanneonaeko
Автор

Sir, Would you mind to share some information how we can use genetic algorithm to shift time for peak load to non peak hours please. Thank You

khanduom