O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Genetic Algorithms and Machine Learning for Programmers

Book Description

Self-driving cars, natural language recognition, and online recommendation engines are all possible thanks to Machine Learning. Now you can create your own genetic algorithms, nature-inspired swarms, Monte Carlo simulations, cellular automata, and clusters. Learn how to test your ML code and dive into even more advanced topics. If you are a beginner-to-intermediate programmer keen to understand machine learning, this book is for you.

Discover machine learning algorithms using a handful of self-contained recipes. Build a repertoire of algorithms, discovering terms and approaches that apply generally. Bake intelligence into your algorithms, guiding them to discover good solutions to problems.

In this book, you will:

  • Use heuristics and design fitness functions.
  • Build genetic algorithms.
  • Make nature-inspired swarms with ants, bees and particles.
  • Create Monte Carlo simulations.
  • Investigate cellular automata.
  • Find minima and maxima, using hill climbing and simulated annealing.
  • Try selection methods, including tournament and roulette wheels.
  • Learn about heuristics, fitness functions, metrics, and clusters.

Test your code and get inspired to try new problems. Work through scenarios to code your way out of a paper bag; an important skill for any competent programmer. See how the algorithms explore and learn by creating visualizations of each problem. Get inspired to design your own machine learning projects and become familiar with the jargon.

What You Need:

Code in C++ (>= C++11), Python (2.x or 3.x) and JavaScript (using the HTML5 canvas). Also uses matplotlib and some open source libraries, including SFML, Catch and Cosmic-Ray. These plotting and testing libraries are not required but their use will give you a fuller experience. Armed with just a text editor and compiler/interpreter for your language of choice you can still code along from the general algorithm descriptions.

Table of Contents

  1.  Preface
    1. Who Is This Book For?
    2. What’s in This Book?
    3. Online Resources
    4. Acknowledgments
  2. 1. Escape! Code Your Way Out of a Paper Bag
    1. Let’s Begin
    2. Your Mission: Find a Way Out
    3. How to Help the Turtle Escape
    4. Let’s Save the Turtle
    5. Did It Work?
    6. Over to You
  3. 2. Decide! Find the Paper Bag
    1. Your Mission: Learn from Data
    2. How to Grow a Decision Tree
    3. Let’s Find That Paper Bag
    4. Did It Work?
    5. Over to You
  4. 3. Boom! Create a Genetic Algorithm
    1. Your Mission: Fire Cannonballs
    2. How to Breed Solutions
    3. Let’s Fire Some Cannons
    4. Did It Work?
    5. Over to You
  5. 4. Swarm! Build a Nature-Inspired Swarm
    1. Your Mission: Crowd Control
    2. How to Form a Swarm
    3. Let’s Make a Swarm
    4. Did It Work?
    5. Over to You
  6. 5. Colonize! Discover Pathways
    1. Your Mission: Lay Pheromones
    2. How to Create Pathways
    3. Let’s March Some Ants
    4. Did It Work?
    5. Over to You
  7. 6. Diffuse! Employ a Stochastic Model
    1. Your Mission: Make Small Random Steps
    2. How to Cause Diffusion
    3. Let’s Diffuse Some Particles
    4. Did It Work?
    5. Over to You
  8. 7. Buzz! Converge on One Solution
    1. Your Mission: Beekeeping
    2. How to Feed the Bees
    3. Let’s Make Some Bees Swarm
    4. Did It Work?
    5. Over to You
  9. 8. Alive! Create Artificial Life
    1. Your Mission: Make Cells Come Alive
    2. How to Create Artificial Life
    3. Let’s Make Cellular Automata
    4. Did It Work?
    5. Over to You
  10. 9. Dream! Explore CA with GA
    1. Your Mission: Find the Best
    2. How to Explore a CA
    3. Let’s Find the Best Starting Row
    4. Did It Work?
    5. Over to You
  11. 10. Optimize! Find the Best
    1. Your Mission: Move Turtles
    2. How to Get a Turtle into a Paper Bag
    3. Let’s Find the Bottom of the Bag
    4. Did It Work?
    5. Extension to More Dimensions
    6. Over to You
  12.  Bibliography