Reader small image

You're reading from  The Applied Artificial Intelligence Workshop

Product typeBook
Published inJul 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781800205819
Edition1st Edition
Languages
Tools
Right arrow
Authors (3):
Anthony So
Anthony So
author image
Anthony So

Anthony So is a renowned leader in data science. He has extensive experience in solving complex business problems using advanced analytics and AI in different industries including financial services, media, and telecommunications. He is currently the chief data officer of one of the most innovative fintech start-ups. He is also the author of several best-selling books on data science, machine learning, and deep learning. He has won multiple prizes at several hackathon competitions, such as Unearthed, GovHack, and Pepper Money. Anthony holds two master's degrees, one in computer science and the other in data science and innovation.
Read more about Anthony So

William So
William So
author image
William So

William So is a Data Scientist with both a strong academic background and extensive professional experience. He is currently the Head of Data Science at Douugh and also a Lecturer for Master of Data Science and Innovation at the University of Technology Sydney. During his career, he successfully covered the end-end spectrum of data analytics from ML to Business Intelligence helping stakeholders derive valuable insights and achieve amazing results that benefits the business. William is a co-author of the "The Applied Artificial Intelligence Workshop" published by Packt.
Read more about William So

Zsolt Nagy
Zsolt Nagy
author image
Zsolt Nagy

Zsolt Nagy is an engineering manager in an ad tech company heavy on data science. After acquiring his MSc in inference on ontologies, he used AI mainly for analyzing online poker strategies to aid professional poker players in decision making. After the poker boom ended, he put extra effort into building a T-shaped profile in leadership and software engineering.
Read more about Zsolt Nagy

View More author details
Right arrow

About the Book

You already know that Artificial Intelligence (AI) and Machine Learning (ML) are present in many of the tools you use in your daily routine. But do you want to be able to create your own AI and ML models and develop your skills in these domains to kickstart your AI career?

The Applied Artificial Intelligence Workshop gets you started with applying AI with the help of practical exercises and useful examples, all put together cleverly to help you gain the skills to transform your career.

The book begins by teaching you how to predict outcomes using regression. You'll then learn how to classify data using techniques such as K-Nearest Nneighbor (KNN) and Support Vector Machine (SVM) classifiers. As you progress, you'll explore various decision trees by learning how to build a reliable decision tree model that can help your company find cars that clients are likely to buy. The final chapters will introduce you to deep learning and neural networks. Through various activities, such as predicting stock prices and recognizing handwritten digits, you'll learn how to train and implement Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs).

By the end of this applied AI book, you'll have learned how to predict outcomes and train neural networks, and be able to use various techniques to develop AI and ML models.

Audience

The Applied Artificial Intelligence Workshop is designed for software developers and data scientists who want to enrich their projects with machine learning. Although you do not need any prior experience in AI, it is recommended that you have knowledge of high-school-level mathematics and at least one programming language, preferably Python. While this is a beginner's book, experienced students and programmers can also improve their Python programming skills by focusing on the practical applications featured in this AI book.

About the Chapters

Chapter 1, Introduction to Artificial Intelligence, introduces AI. You will also be implementing your first AI through a simple tic-tac-toe game where you will be teaching the program how to win against a human player.

Chapter 2, An Introduction to Regression, introduces regression. You will come across various techniques, such as linear regression, with one and multiple variables, along with polynomial and support vector regression.

Chapter 3, An Introduction to Classification, introduces classification. Here, you will be implementing various techniques, including k-nearest neighbors and support vector machines.

Chapter 4, An Introduction to Decision Trees, introduces decision trees and random forest classifiers.

Chapter 5, Artificial Intelligence: Clustering, really starts getting you thinking in new ways with your first unsupervised models. You will be introduced to the fundamentals of clustering and will implement flat clustering with the k-means algorithm and hierarchical clustering with the mean shift algorithm.

Chapter 6, Neural Networks and Deep Learning, introduces TensorFlow, Convolutional Neural Networks (CNNs), and Recurrent Neural Networks (RNNs). You will also be implementing an image classification program using neural networks and deep learning.

Conventions

Code words in text, folder names, filenames, file extensions, pathnames, and user input are shown as follows: "Please note that this function is in the tensorflow namespace, which is not referred to by default.”

A block of code is set as follows:

features_train = features_train / 255.0
features_test = features_test / 255.0

New terms and important words are shown like this: "Mean-shift is an example of hierarchical clustering, where the clustering algorithm determines the number of clusters.”

Code Presentation

Lines of code that span multiple lines are split using a backslash ( \ ). When the code is executed, Python will ignore the backslash, and treat the code on the next line as a direct continuation of the current line.

For example:

history = model.fit(X, y, epochs=100, batch_size=5, verbose=1, \
                   validation_split=0.2, shuffle=False)

Comments are added into code to help explain specific bits of logic. Single-line comments are denoted using the # symbol, as follows:

# Print the sizes of the dataset
print("Number of Examples in the Dataset = ", X.shape[0])
print("Number of Features for each example = ", X.shape[1])

Multi-line comments are enclosed by triple quotes, as shown below:

"””
Define a seed for the random number generator to ensure the 
result will be reproducible
"””
seed = 1
np.random.seed(seed)
random.set_seed(seed)

Setting up Your Environment

Before we explore the book in detail, we need to set up specific software and tools. In the following section, we shall see how to do that.

Installing Jupyter on Your System

To install Jupyter on Windows, MacOS, and Linux, perform the following steps:

  1. Head to https://www.anaconda.com/distribution/ to install the Anaconda Navigator, which is an interface through which you can access your local Jupyter notebook.
  2. Now, based on your operating system (Windows, MacOS, or Linux), you need to download the Anaconda Installer. Have a look at the following figure where we have downloaded the Anaconda files for Windows:
    Figure 0.1: The Anaconda home screen

Figure 0.1: The Anaconda home screen

Launching the Jupyter Notebook

To launch the Jupyter Notebook from the Anaconda Navigator, you need to perform the following steps:

  1. Once you install the Anaconda Navigator, you will see the screen shown in Figure 0.2:
    Figure 0.2: Anaconda installation screen

    Figure 0.2: Anaconda installation screen

  2. Now, click on Launch under the Jupyter Notebook option and launch the notebook on your local system:
    Figure 0.3: Jupyter Notebook launch option

Figure 0.3: Jupyter Notebook launch option

You have successfully installed Jupyter Notebook on your system.

Installing Libraries

pip comes pre-installed with Anaconda. Once Anaconda is installed on your machine, all the required libraries can be installed using pip, for example, pip install numpy. Alternatively, you can install all the required libraries using pip install –r requirements.txt. You can find the requirements.txt file at https://packt.live/3erXq0B.

The exercises and activities will be executed in Jupyter Notebooks. Jupyter is a Python library and can be installed in the same way as the other Python libraries – that is, with pip install jupyter, but fortunately, it comes pre-installed with Anaconda. To open a notebook, simply run the command jupyter notebook in the Terminal or Command Prompt.

A Few Important Packages

Some of the exercises in this chapter require the following packages:

  • EasyAI
  • Quandl
  • TensorFlow 2.1.0

Install them by following this guide. On Windows, open up Command Prompt. On macOS or Linux, open up Terminal.

To install easyAI and Quandl, type the following command:

pip install easyAI==1.0.0.4 Quandl==3.5.0 tensorflow==2.1.0

Accessing the Code Files

You can find the complete code files of this book at https://packt.live/31biHYK. You can also run many activities and exercises directly in your web browser by using the interactive lab environment at https://packt.live/2Vbev7E.

We've tried to support interactive versions of all activities and exercises, but we recommend a local installation as well for instances where this support isn't available.

If you have any issues or questions about installation, please email us at workshops@packt.com.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
The Applied Artificial Intelligence Workshop
Published in: Jul 2020Publisher: PacktISBN-13: 9781800205819
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Anthony So

Anthony So is a renowned leader in data science. He has extensive experience in solving complex business problems using advanced analytics and AI in different industries including financial services, media, and telecommunications. He is currently the chief data officer of one of the most innovative fintech start-ups. He is also the author of several best-selling books on data science, machine learning, and deep learning. He has won multiple prizes at several hackathon competitions, such as Unearthed, GovHack, and Pepper Money. Anthony holds two master's degrees, one in computer science and the other in data science and innovation.
Read more about Anthony So

author image
William So

William So is a Data Scientist with both a strong academic background and extensive professional experience. He is currently the Head of Data Science at Douugh and also a Lecturer for Master of Data Science and Innovation at the University of Technology Sydney. During his career, he successfully covered the end-end spectrum of data analytics from ML to Business Intelligence helping stakeholders derive valuable insights and achieve amazing results that benefits the business. William is a co-author of the "The Applied Artificial Intelligence Workshop" published by Packt.
Read more about William So

author image
Zsolt Nagy

Zsolt Nagy is an engineering manager in an ad tech company heavy on data science. After acquiring his MSc in inference on ontologies, he used AI mainly for analyzing online poker strategies to aid professional poker players in decision making. After the poker boom ended, he put extra effort into building a T-shaped profile in leadership and software engineering.
Read more about Zsolt Nagy