Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Artificial Intelligence with Python
  • Table Of Contents Toc
Artificial Intelligence with Python

Artificial Intelligence with Python

By : Prateek Joshi
3.6 (34)
close
close
Artificial Intelligence with Python

Artificial Intelligence with Python

3.6 (34)
By: Prateek Joshi

Overview of this book

Artificial Intelligence is becoming increasingly relevant in the modern world. By harnessing the power of algorithms, you can create apps which intelligently interact with the world around you, building intelligent recommender systems, automatic speech recognition systems and more. Starting with AI basics you'll move on to learn how to develop building blocks using data mining techniques. Discover how to make informed decisions about which algorithms to use, and how to apply them to real-world scenarios. This practical book covers a range of topics including predictive analytics and deep learning.
Table of Contents (17 chapters)
close
close

Building an intelligent robot controller


Let's see how to build a robot controller using a genetic algorithm. We are given a map with the targets sprinkled all over it. The map looks like this:

There are 124 targets in the preceding map. The goal of the robot controller is to automatically traverse the map and consume all those targets. This program is a variant of the artificial ant program given in the deap library.

Create a new Python file and import the following:

import copy 
import random 
from functools import partial 
 
import numpy as np 
from deap import algorithms, base, creator, tools, gp 

Create the class to control the robot:

class RobotController(object): 
    def __init__(self, max_moves): 
        self.max_moves = max_moves 
        self.moves = 0 
        self.consumed = 0 
        self.routine = None 

Define the directions and movements:

        self.direction = ["north", "east", "south", "west"] 
        self...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Artificial Intelligence with Python
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon