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 Hands-On Artificial Intelligence for Search
  • Table Of Contents Toc
Hands-On Artificial Intelligence for Search

Hands-On Artificial Intelligence for Search

By : Devangini Patel
4 (1)
close
close
Hands-On Artificial Intelligence for Search

Hands-On Artificial Intelligence for Search

4 (1)
By: Devangini Patel

Overview of this book

With the emergence of big data and modern technologies, AI has acquired a lot of relevance in many domains. The increase in demand for automation has generated many applications for AI in fields such as robotics, predictive analytics, finance, and more. In this book, you will understand what artificial intelligence is. It explains in detail basic search methods: Depth-First Search (DFS), Breadth-First Search (BFS), and A* Search, which can be used to make intelligent decisions when the initial state, end state, and possible actions are known. Random solutions or greedy solutions can be found for such problems. But these are not optimal in either space or time and efficient approaches in time and space will be explored. We will also understand how to formulate a problem, which involves looking at it and identifying its initial state, goal state, and the actions that are possible in each state. We also need to understand the data structures involved while implementing these search algorithms as they form the basis of search exploration. Finally, we will look into what a heuristic is as this decides the quality of one sub-solution over another and helps you decide which step to take.
Table of Contents (5 chapters)
close
close

Visualizing a search tree

In the previous chapter, you learned that a graph is a structure in which nodes are connected by edges. A tree is a special type of graph, in which there are no cycles and two nodes are connected by one path. For visualizing trees, we'll use the pydot Python library, which is a Python interface to Graphviz's DOT language. In Chapter 1, Understanding the Depth-First Search Algorithm, we learned that Graphviz is open source graph visualization software, and it provides the DOT language for creating layered drawings of directed graphs. In addition, we'll be using the matplotlib library for displaying the final rendered image.

Now, let's use these libraries to visualize the following simple tree. It has a root node, and three children under the root node:

Figure 5

Consider the following code:

...
import pydot
import matplotlib.image as...
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.
Hands-On Artificial Intelligence for Search
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