Introduction to Deep Learning and Neural Networks with Python A Practical Guide Full-Resolution Download
Introduction to Deep Learning and Neural Networks with Python A Practical Guide Full-Resolution Download
Visit the link below to download the full version of this book:
https://medidownload.com/product/introduction-to-deep-learning-and-neural-networ
ks-with-pythontm-a-practical-guide/
xi
xii Preface
Thanks, Allah, for inspiring us to write this book. It was a dream that comes into
action. We should clearly admit that our success is not only about being skillful
in something but the willingness of Allah [And my success is not but through
Allah. Upon him I have relied, and to Him I return. (Hud 88)].
We are keeping thanking Allah as David and Solomon previously did in
Surat An Naml 15 [We gave (in the past) knowledge to David and Solomon:
And they both said: “Praise be to Allah, Who has favoured us above many of his
servants who believe!” (An Naml 15)].
Thanks to our parents who did everything possible to help us in our life with-
out expecting a reward. While you surround us at home, we are safe and feel that
nothing can beat us. We hope to be grateful to you as said in Surat Luqman 14
[Be grateful to Me and to your parents; to Me is the [final] destination].
It is a wonderful experience to have our book published by Elsevier. Natalie
Farra, an acquisition editor, is a friendly person who cares about the subtle de-
tails. I never had a question that was not answered accurately in adequate time.
Sara Pianavilla, editorial project manager, supported us from submitting the
content to preparing the cover in a smooth process. Thanks to Punitha Radjane
for the information about the proofing system.
Motivated by this Hadith [AbuHurayrah reported that the Prophet Mohamed
( )ﷺsaid, “He who does not thank people does not thank Allah.”], we sepa-
rately thank the people who motivated and helped us to complete this book.
xiii
xiv Acknowledgments
Life has many kind people and Prof. Amiya Nayak, a lecturer at the
University of Ottawa, is one of them. You are an initiator who saves no effort in
pushing and assisting me to continue my career.
Thanks to my childhood friend Ibrahim Elhagali for the continued support
and enthusiasm to push me emotionally. Keep up the good work you are doing
and I am confident that you will go beyond our expectations.
Thanks to Paperspace represented by its CEO Dillon Erb, COO Daniel
Kobran, and community manager Rachel Rapp for hosting my works. The same
goes for the Fritz AI team lead by CEO Dan Abdinoor, CTO Jameson Toole,
and head of Heartbeat community Austin Kodra. Feeling that you appreciate my
work is a key driver to write this book.
Thanks to my mother, father (may Allah have mercy on him), brother, sis-
ters, and all family members for standing with me. You relieved much load in
the last years and I hope I can do so in the future.
ABSTRACT
This chapter prepares the development environment that is used in the following chap-
ters. The book uses Python 3; thus, the chapter discusses how to download and install it.
On top of Python, a number of libraries are necessary to be installed. These libraries
include NumPy, Matplotlib, Cython, and Kivy. For building mobile applications out of
Kivy, a Linux system must exist. For this purpose, an Ubuntu virtual machine is prepared.
The chapter also gets the reader ready to use the recent Python implementation called
“PyPy” to see how it could boost the performance of Python scripts.
After the Python 2 sunset date (January 1, 2020), Python 3 is the only sup-
ported version of Python. Its development started in 2008. There might still be
some Python 2 users but by time, Python 2 will die and only Python 3 will exist.
For that reason, this book uses Python 3.
The book source code is developed using Python 3.7. The latest Python 3
version is 3.8, which can still be used to run the book’s code without changes.
At the time of writing this chapter, the latest release of Python 3 (3.8.5) is pub-
lished on July 2, 2020.
The official Python website is python.org from which Python 3 can be
downloaded from the downloads page. To download Python 3.8.5, use this link:
python.org/downloads, which forwards to a page like that in Fig. 1.1. To down-
load Python 3.8.5 for Windows, use this link: https://www.python.org/ftp/py-
thon/3.8.5/python-3.8.5.exe. Its size is about 25 MB.
For Linux, Python 3 comes already installed. To upgrade to a specific ver-
sion, use this terminal command:
sudo apt install python3.8
For Mac, use this command:
brew install python3
After Python 3.8 is installed, one way of accessing it is through the terminal/
command prompt. For Windows and Mac, issue the python command as in
Fig. 1.2. For Linux, issue the python3 command.
popular IDE is PyCharm, which can be downloaded from this page jetbrains.
com/pycharm/download.
The Jupyter project is also a favorable choice for data scientists as it offers
notebooks in which not only code but also text and images can be embedded.
The Jupyter Notebook comes already installed in Anaconda. To activate it, issue
the next command from the terminal. It activates a server that handles a web-
based Jupyter Notebooks.
jupyter notebook
After the server runs, a new web page opens, as in Fig. 1.4, from which
Jupyter Notebooks can be created.
From the New button, select the version of Python used in the notebook and
it opens in a new browser tab as in Fig. 1.5.
Similar to the pip installer in the native Python distribution, Anaconda sup-
ports a new installer called “conda.” One of the differences between the two
installers is the cloud-based repository from which the installer searches for the
libraries. pip searches for the libraries in pypi.org where conda searches in
repo.anaconda.com. Note that pip can still be used to install libraries in the
Anaconda environment.
If conda is used to install a nonconda library (i.e., a library that is not available
at the Anaconda package repository), an error occurs similar to that in Fig. 1.6.
After Python is installed, the next section discusses the libraries that will be
used in the book.
a number of widgets that are compatible with Kivy and approximate Google’s
Material Design spec. Buildozer is a tool for building the Kivy applications for
mobile devices.
Kivy applications can be developed in Linux, Mac, and Windows. Kivy can
be installed using pip. Use pip3 rather than pip for Linux and Mac.
pip install kivy
Similarly, install KivyMD:
pip install kivymd
For deploying the Kivy applications to Android, which is the focus of this
book, only the Linux and OSX platforms support Buildozer. For iOS, only
OSX can be used. The next section prepares the Kivy environment in Linux for
building Android applications.
Click Next to move to the window in Fig. 1.11 where the directory of the
downloaded Ubuntu ISO image is specified.
Click Next to open a new window as in Fig. 1.12 to create a new user by
entering the username and password. Remember them to log in to the OS after
being installed.
By clicking Next, the window in Fig. 1.13 appears to enter the VM name and
its location where all VM files are saved. Later, this location may be copied to
create a backup of the VM.
Click Next to move to the window in Fig. 1.14 to specify the disk size of the
VM. It defaults to 20 GB but you can increase it as much as you can to make
a room for the files and libraries downloaded later. If possible, set the size to
40 GB.
After clicking Next, a final Window appears summarizing the settings of the
VM as in Fig. 1.15. By default, the machine uses 2 GB of RAM, one processor,
and one core per processor. These settings are not the best.
Click the Customize Hardware button to customize these settings as in
Fig. 1.16. According to your physical RAM size, increase the RAM assigned
to the VM. In our case, 6 out of 16 GBs are assigned to the VM. From the
Processors tab, increase the number of cores assigned to the processor to
nearly half.
Preparing the development environment Chapter | 1 9