37:449.8: Weighted Selection (for Genetic Algorithms) - The Nature of Code
From the creator
In this video, I look at yet another technique for "pool selection" -- how to pick an item randomly from an array with a non-uniform distribution, i.e. some elements have higher probability of being picked than others. I use this same method in my Traveling Salesperson coding challenge, but it can be applied more broadly. Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/9-genetic-algorithms/8-improved-pool-selection 🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/eBrC90hCl 🎥 Previous: https://youtu.be/816ayuhDo0E?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM 🎥 Next: https://youtu.be/Zy_obitkyOE?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM 🎥 All: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM References: 🔗 Nature of Code: https://nature-of-code-2nd-edition.netlify.app/ 🔗 Even Better GA Selection Pool Algorithm: https://github.com/CodingTrain/Suggestion-Box/issues/146 🔗 Genetic Algorithm: Random Pool Selection: https://github.com/CodingTrain/Suggestion-Box/issues/119 Related Coding Challenges: 🚂 https://youtu.be/BAejnwN4Ccw 🚂 https://youtu.be/5cNnf_7e92Q Timestamps: 0:00 Hello 5:52 Explain improved algorithm 7:20 Github issues 8:01 Start coding 8:41 Normalize the fruit score 10:44 Pick a fruit randomly according to its probability 12:13 Diagram the algorithm 15:50 Verify the algorithm works 17:48 Advantages of the algorithm 18:16 Outro Editing by Mathieu Blanchette Animations by Jason Heglund Music from Epidemic Soun
Published 2017-05-03 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





