Genetic Algorithms with Python
P**L
Unbelievably Useful Book, but Not for Beginners
I bought GAWP over a year ago, when I was working on a Genetic Algorithm chapter for my book Math Adventures with Python. I've had a lot of experience with Python, so I didn't need a tutorial on strings and variables. If you're new to Python or programming, you might want to start with another book. Sheppard throws the reader into the deep end. But the projects cover all the classics of GA's, like the 8 Queens Puzzle, Magic Squares, Sudoku and the project I was particularly interested in, the Traveling Salesman Problem.Other reviewers have complained about the author's use of Python's unittest module, but it might be the reason his code runs 2 or 3 times faster than mine. It's a great hands-on introduction to testing, as well. Another bonus is Sheppard recommends using Pycharm for an editor.After writing a bunch of code to solve the first problem in the book, Guess the Password, Sheppard takes the code that will just be repeated in every future program and extracts it to a "genetic" file that will be reused, possibly with some modifications, for the rest of the book. This risky move is a stroke of genius, but one that is clearly lost on some reviewers. It's true, the author only includes a handful of graphics and charts in the entire book, and it's not easy to keep track of which function/method goes where at first (or second!).Having said all that, the book contains absolutely indispensable projects for the intermediate programmer interested in really delving into using Genetic Algorithms to solve puzzles and problems. Challenging as it is, I keep going back to this book to work on problems. It's not the type of book you'll only go through once; but you'll keep learning something every time you work on one of its projects. All the code is available in the appendix and online.
M**L
Good book for getting your feet wet with genetic algorithms and python.
I like this book a lot. One of the things I like about it is that the author takes a lot of different examples, and step-by-step teaches you the elements of genetic algorithms, and also improves the algorithms over the course of the book.I'd say if you want to learn genetic algorithms this is certainly a good book. I'll be looking for some more theoretical books to round out my knowledge, but this is a great start for someone who knows python, but isn't super familiar with how genetic algorithms work.One of the things I don't like about the book is that it doesn't actually talk about the overall concept of what genetic algorithms do in a way that makes it super easy to apply to other problems. I do think the point of the step-by-step approach was to give you some of that, but somehow it didn't quite work for me I needed a little bigger picture explanations of the conceptual frameworks behind the code that he uses.But the author does, with each subsequent chapter, add new, more complex concepts and new ways to do mutation and checking fitness, which is great.
P**E
Good introduction to genetic algorithms without math
Overall, good introduction to genetic algorithms for those without a mathematical background. Focuses on a high level view of concepts and applications.The Good: The author is clear, which makes the book easy to read. The code is written well, albeit, for the consumption of a CS major than a generalist. The examples are short and fun to work with. The book is much easier to read than more rigorous texts on genetic algorithms.The Bad: The author chose to use `unittest` for running the genetic algorithms which makes the code difficult to read at times, and kind of annoying to work with. I'm a statistician, and although I do run tests for my programs, I prefer to not use `unittest` unless it's absolutely necessary.Overall, I like this book, even though the print quality may not be great. But the low print quality may be the reason why this book is affordable.
S**H
I got the first program working and am working through ...
I got the first program working and am working through the rest of the material. It focuses heavily on the Python programming environment. I have read and understand the first half of the first chapter. The author jumps quickly into object oriented programming style which I am not familiar. i am hoping to extract information about how to design genotypes and fitness tests. I am trying to use the information to program an artificial neural network. I will continue to think and study this book. It seems to be a book worth the time to learn. My background in procedural programming style of programming is being challenged by the conversion to object oriented programming style.
C**C
very good!
This was a great book to learn Python as well as genetic algorithms. I thought the problems were very interesting and the code is written so that it gets more sophisticated with each problem. A highly recommend this book if you are looking for some hands-on time with Python and genetic algorithms. There's a lot of problems to solve, making it a great value.
D**R
Python nuts and bolts done right
This title is very code intensiveThe chapter ' Generating Sudoku 'Is very valuable . Many other titles are for the solving of Sudoku which is all well and good but by generating aSudoku far more mathematics is learned.Clinton Sheppard has done agreat job combining math and coding.
S**M
Too much noise and boilerplate. Motives unclear.
I hate to be the Debbie Downer here, but...this book has you trudging through hours of idiosyncratic python code just to get to a program that flips bits from 0 to 1. It's another python book that succeeds in taking the fun and exploration out of programming. The author claims that the language used is not that important, but the obtuse nature of the code belies a possible primary intent to turn a personal code library into an additional source of income, with the goal of teaching the material in an engaging way taking a secondary back-seat.I remember many years ago, in a computer science class, using Lisp and genetic algorithms to optimize the travelling salesman problem. I was pretty amazed at the results that were obtained with maybe 3/4 page worth of code. That is how you get someone engaged in a powerful programming paradigm. This is not the way. There may be a lot of good, even very good information, in this book. But, the amount of boilerplate and noise is just unreasonable.
G**R
Very disappointing - Really just a book of code listings
This book consists of descriptions of python programs used to solve some small genetic programming problems. Most of the book consists of code listings with a small amount of text around them explaining what each function does. The last 150 pages of the book just repeats the listings without any text descriptions. The author admits that he wrote the book while learning python (and it shows). The code is very poor and makes little or no use of any of the advanced features that are available within the language.The book doesn't explain either genetic programming or how to write good python code. Its best avoided. If you want to learn about genetic programming I'd recommend something like Essentials of Metaheuristics by Sean Luke, and if you want to improve your python programming there are many better books. At the advanced level, I've enjoyed Fluent Python by Luciano Ramalho.
E**M
Five Stars
Lovely gentle introduction to GAs for people who want to use them, even some Genetic Genetic Algorithms!
C**A
Medium
The book makes a good basic introduction to genetic algorithms for absolute beginners that have some previous knowledge on OOP programming .
T**Y
Good rundown of various Genetic Algorithms being coded from scratch
I found the book pretty helpful. This is a book that gets to implementing ideas fast and progresses consistently towards goals. I found some of the author's code choices stylistically strange but it is important to remember this is a book about real world construction of genetic algorithms and not some rundown of best practices. This would be one of my recommended books on this subject as most books get bogged down into filler material whereas this is a fast paced manual on developing a genetic engine.
L**K
Excellent hands-on introduction to Genetic Algorithms
This is a great introductory book for all who are interested in genetic algorithms, and are capable to write and follow Python code at an intermediate level. The book begins with an easy Word Guessing problem and shows how a GA can approach it. Mutation and fitness function are explained first, and then, step by step, from chapter to chapter, the problems get more intriguing and harder and the simple GA engine evolves to more complex, yet well understandable, tool incorporating concepts of genotype-phenotype interactions, local minimum/maximum, mimetic algorithms, simulated annealing, custom mutation, crossover, genes pools, and so on. The problems used to illustrate how GA work (Eight Queens Puzzle, Magic Square, Knapsack Problem, Creating Sudoku, Traveling Salesman Problem... to name just few) are themselves interesting enough to make you follow Mr. Sheppard's explicit encouragement to stop reading for a while at the beginning of each chapter, and to try to solve them by yourself, before continuing reading to see the author's approach. Try it; this is a great exercise! The Python code used in the book is easy to follow; after having learned Python for about six months, and having no knowledge of computer sciences (although with solid understanding of natural evolution and molecular biology :)) I was able to decipher most of the tricks in the code, and those that I was not able made me search on the internet, which is an added value of reading this book. There is an accompanying webpage, where you can find all the codes ready to download, but I have to admit I re-wrote everything by hand while reading the book, abstaining from copying-and-pasting from the internet. It certainly took me longer, but forced me to try to understand what every line is supposed to do, and weather I couldn’t have done it better :) Here and there a bit more explanations of theory would not hurt (What is so magic in the number "397" in hashing?), but again, if you have access to the internet (you probably have, haven't you...), go on and make your own research! In ten minutes everything will be crystal clear.The book is definitely recommended!PS. And half-star extra for not following the annoying “spam-eggs-ham” naming convention.Piotr Lewczuk
Trustpilot
1 week ago
5 days ago