Book Image

Artificial Intelligence By Example - Second Edition

By : Denis Rothman
Book Image

Artificial Intelligence By Example - Second Edition

By: Denis Rothman

Overview of this book

AI has the potential to replicate humans in every field. Artificial Intelligence By Example, Second Edition serves as a starting point for you to understand how AI is built, with the help of intriguing and exciting examples. This book will make you an adaptive thinker and help you apply concepts to real-world scenarios. Using some of the most interesting AI examples, right from computer programs such as a simple chess engine to cognitive chatbots, you will learn how to tackle the machine you are competing with. You will study some of the most advanced machine learning models, understand how to apply AI to blockchain and Internet of Things (IoT), and develop emotional quotient in chatbots using neural networks such as recurrent neural networks (RNNs) and convolutional neural networks (CNNs). This edition also has new examples for hybrid neural networks, combining reinforcement learning (RL) and deep learning (DL), chained algorithms, combining unsupervised learning with decision trees, random forests, combining DL and genetic algorithms, conversational user interfaces (CUI) for chatbots, neuromorphic computing, and quantum computing. By the end of this book, you will understand the fundamentals of AI and have worked through a number of examples that will help you develop your AI solutions.
Table of Contents (23 chapters)
21
Other Books You May Enjoy
22
Index

To get the most out of this book

Artificial intelligence projects rely on three factors:

  • Understanding the subject the AI project will be applied to. To do so, go through a chapter to pick up the key ideas. Once you understand the key ideas of a case study described in the book, try to see how an AI solution can be applied to real-life examples around you.
  • The mathematical foundations of the AI algorithms. Do not skip the mathematics equations if you have the energy to study them. AI relies heavily on mathematics. There are plenty of excellent websites that explain the mathematics used in this book.
  • Development. An artificial intelligence solution can be directly used on an online cloud platform machine learning site such as Google. We can access these platforms with APIs. In the book, Google Cloud is used several times. Try to create an account of your own to explore several cloud platforms to understand their potential and their limits. Development remains critical for AI projects.

Even with a cloud platform, scripts and services are necessary. Also, sometimes, writing an algorithm is mandatory because the ready-to-use online algorithms are insufficient for a given problem. Explore the programs delivered with the book. They are open source and free.

Technical requirements

The following is a non-exhaustive list of the technical requirements for running the codes in this book. For a more detailed chapter-wise list, please refer to this link: https://github.com/PacktPublishing/Artificial-Intelligence-By-Example-Second-Edition/blob/master/Technical%20Requirements.csv.

Package Website

Python

https://www.python.org/

NumPy

https://pypi.org/project/numpy/

Matplotlib

https://pypi.org/project/matplotlib/

pandas

https://pypi.org/project/pandas/

SciPy

https://pypi.org/project/scipy/

scikit-learn

https://pypi.org/project/scikit-learn/

PyDotPlus

https://pypi.org/project/pydotplus/

Google API

https://developers.google.com/docs/api/quickstart/python

html

https://pypi.org/project/html/

TensorFlow 2

https://pypi.org/project/tensorflow/

Keras

https://pypi.org/project/Keras/

Pillow

https://pypi.org/project/Pillow/

Imageio

https://pypi.org/project/imageio/

Pathlib

https://pypi.org/project/pathlib/

OpenCV-Python

https://pypi.org/project/opencv-python/

Google Dialogflow

https://dialogflow.com/

DEAP

https://pypi.org/project/deap/

bitstring

https://pypi.org/project/bitstring/

nengo

https://pypi.org/project/nengo/

nengo-gui

https://pypi.org/project/nengo-gui/

IBM Q

https://www.research.ibm.com/ibm-q/

Quirk

http://algassert.com/2016/05/22/quirk.html

Download the example code files

You can download the example code files for this book from your account at www.packt.com/. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at http://www.packt.com.
  2. Select the Support tab.
  3. Click on Code Downloads.
  4. Enter the name of the book in the Search box and follow the on-screen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Artificial-Intelligence-By-Example-Second-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781839211539_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example; "The decision tree program, decision_tree.py, reads the output of the KMC predictions, ckmc.csv."

A block of code is set as follows:

# load dataset
col_names = ['f1', 'f2','label']
df = pd.read_csv("ckmc.csv", header=None, names=col_names)
if pp==1:
    print(df.head())

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

for i in range(0,1000):
    xf1=dataset.at[i,'Distance']
    xf2=dataset.at[i,'location']
    X_DL = [[xf1,xf2]]
    prediction = kmeans.predict(X_DL)

Any command-line input or output is written as follows:

Selection: BnVYkFcRK Fittest: 0 This generation Fitness: 0 Time Difference: 0:00:00.000198

Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "When you click on SAVE, the Emotions progress bar will jump up."

Warnings or important notes appear like this.

Tips and tricks appear like this.