O'Reilly logo

Artificial Intelligence with Python by Prateek Joshi

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

Generating a bit pattern with predefined parameters

Now that we know how a genetic algorithm works, let's see how to use it to solve some problems. We will be using a Python package called DEAP. You can find all the details about it at  http://deap.readthedocs.io/en/master . Let's go ahead and install it by running the following command on your Terminal:

$ pip3 install deap

Now that the package is installed, let's quickly test it. Go into the Python shell by typing the following on your Terminal:

$ python3

Once you are inside, type the following:

>>> import deap

If you do not see an error message, we are good to go.

In this section, we will solve a variant of the One Max problem. The One Max problem is about generating a bit string that contains ...

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

Start Free Trial

No credit card required