Machine Learning
Machine Learning
Learning
d-25
Light="red"
o/wn
on
Anuradha Srinivasaraghavan
Vincy Joseph
WILEYY
Machine
Learning
Anuradha Srinivasaraghavan
Associate Professor,
Department of Computer Engineering,
St. Francis Institute
of Technology,
Mumbai, Maharashtra
Vincy Joseph
Assistant Professor,
Department of Computer Engineering,
St. Francis Institute
of Technology,
Mumbai, Maharashtra
WILEY
Contents
Preface vii
About the Authors
ix
LEARNING OUTCOMES
Students will be able to define the term Students will be able to sketch appropri-
machine learning and comprehend different ate machine learning techniques for different
types of learning. applications.
Students will be able to differentiate berween
supervised, unsupervised and reinforcement
learning techniques.
experience.
4
CHAPTER 1/INTRODUCTTION TO
MACHINE
robot navigation in a maze. Here
LEARNIN
Consider as an example,
. Class of task: Reaching the end of the maze.
2. Performance measurement: Time taken to reach the end of the maze
3. Source of experience: Navigating the maze from start to finish by the robot.
Example 1.1
On online traffic networks, mobile applications estimate price of ride and time of arrival at destinaton
riae based
using machine learning. For instance, Uber ATG uses machine learning to define price of the b
on the demand of riders and trafic in that
region.
Computer
Science Statistics
Machine
Learning/
Engineering
Example 1.3
Cancidet that you purchased an item from Amazon. After your purchase, you may find pop-up adver-
icements for shopping The product recommendations may be related to what you purchased. For
ctance, if you purchased a mobile phone online, then the site from where you purchased it immedi-
aTely recommends a cover for the phone purchased as shown in Fig. 1.2.
Machine learning uses algorithms to find patterns in data and then model that
terns to make
uses a
recognizes those pat-
predictions on new data. This is nothing but pattern recognition (Fig. 1.3).
Machine learning can be implemented in the healthcare sector, providing opportunities
to facilitate
and enhance the work of medical
experts and to improve the efficiency and quality of medical care. In
medical diagnosis, the main interest is in establishing the existence of a disease followed by its accurate
Identihcation. Machine learning can improve the accuracy of medical diagnosis by analyzing historical
data of patients for various categories of diseases. Measurements in this application are typically results of
certain medical tests
(such as blood pressure, temperature and various blood tests), medical diagnostics
uch medical
as
images), presencelabsence/intensity ofvarious symptoms and basic physical information
Predictions
Training Model:
algorithm:
Finds
Recognizes
patterns
patterns
Data
New Data
m e a s u r e s can
then be advised by doctors.
prognostic
Used?
Where is Machine Learning
1.2
like? Have you wondered how
Are you fascinated by how
Netfix recommends movies you might Goog
Machine learning is behind these technological advances. It represe
shows you such accurate search results?
evolution in the fhields of computer science,
data analysis, software engineering and artificial intellioen
a key
1.4 shows how machine learning is used in Google.
Figure
Jobs
Réear Miumba: 3taharastitra
Data Scieces-
froctab Fractal Analytics
1Aumbai tAaharashtra
Vid LinKedln
languages.
the highest-traffic job website in the In October 2010,
Indeed.com passed Monster.com
010, Indeed.com been a 2000
learning. Supervised learning trains algorithms based on example input and output data that is labeled b»
humans. Unsupervised learning provides the
structure or pattern within its
algorithm with no labeled data in order to allow it to fine
input data. Let's explore these two methods in more detail.
1.4.1 Supervised Learning
In supervised learning.
the conmputer is
provided with example inputs that are labeled with their desirec
outputs. The purpose of this method is for the algorithm to be able to "learn"
output with the "taught" ourputs to find errors, and modify the model
by comparing its actua
therefore uses patterns to predict label values on additional unlabeled accordingly. Supervised learning
data. t is similar to how a teache=
teaches his/her students. The teacher, or tutor, examines the
the solution known him/her
performance of the students and corrects witl-
to desired by him/her.
or
For example, suppose you have a fruit basket and your task is to
arrange the fruit by type (Fig. l.6).
So if we want to separate the fruits from a fruit basket based on color, which is the first feature, then apples
and cherries would be categorized in one group and watermelon and grapes would be in another group.
But if we want to automate this process of fruit categorization then the feature "color" alone would not be
sufhcient to group them. So we make use of the additional feature "size". If the color is red and size is small
the fruit is classified as cherry ese apple, as shown in Fig. 1.8. In the case of green fruits, if the color is green
and size is big then the fruit is classifhed as watermelon else grape.
Red color and big size group: Apples Green color and big size group: Watermelons
Red color and small size group: Cherries Green color and small size group: Grapes
binary classification problem, single training test item (instance) canproblembe divided
is binary
i . a In
a or
Example:
ResearchersCreating
Algorithms that Can Analyze Works of Art
at the Art and Artificial Intelligence Laboratory at Rutgers University wanted to see whether a
as a human. They began by
computer algorithm could classify paintings by style, genre and artist as casily
identifying visual features for classifying a painting's style. The algorithms they developed classified the styles
of paintings in the database with 60% accuracy, outperfornming typical non-expert humans. The researchers
hypothesized that visual features are useful for style classification (a supervised learning problem). They used
classification algorithms trained on Google images to identify specific objects. They tested the algorithms on
more than 1,700 paintings from 66 different artists working over a span of 550 years. The algorithm readily
identified connected works, including the influence of Diego Velazquez's "Portrait of Pope Innocent X" on
Francis Bacon's "Study After Velazquezs Portrait of Pope Innocent X."
aatt
Most unsupervised learning techniques are a form of cluster analysis. In such analysis, data is partitioned
into groups based on some measure of similarity or shared characteristic. Clusters are
formed so that objects
in the same cluster are very similar and objects in difterent clusters are
very distinct.
Clustering algorithms
fall into two broad groups: (a) hard custering, where cach data point
belongs only cluster and (b) can
to one
clustering, where cach data point can belong to more than one cluster. Hard or soft clustering techniques soft
be used if you already know the possible data groupings.
hati
VIS
end
tos
15
ter running the algorithm, the team can accurately determine the results of partitioning the data into
three and four
clusters.
CHAPTER 1/INTRODUCTION TO MACHINE LEARNIN
12
(0.03, 0.97) OO
(0.47, 0.53)
and circles.
1.11 Two clusters represented by hexagons
Figure
concerned wi
1.4.3 Reinforcement Learning behaviorist psychology,
is an area of machine learning inspired by notion of cumulau
Reinforcement learning e n v i r o n m e n t so as to
maximize some
action in an
such as game theory,
ca
how software agents ought to take in other disciplines,
to its generality,
is studied many
multi-agent syster
reward. The problem, due simulation-based optimization,
information theory, literature, t
trol theory, operations
research, research and control
In the operations
statistics and genetic algorithms. programming
Swarm intelligence,
methods are studied is
called approximate dynamic
held where reinforcement learning
hree
Example 1.6 1.12). Two players
take play1ng on a
turns
the familiar child's game of tic-tac-toe (Fig. wins by placing three marks
Consider the other O's. A player
board. One player plays X's and three in a row, thc
by-three board fills with neither player getting aga
If the up
that w e a r e playing
tally, vertically, or diagonally. to lose, let us assume cor
nside
xOO
OXX
X
Figure 1.12 The tic-tac-toe game.
Although this is a simple problem, it cannot readily be solved in a satisfactory way through classical techniques.
For example, the classical minimax solution from game theory is not applicable here because it assumes a partic-
ular way of playing by the opponent. A minimax player would never reach a game state from which it could lose,
even if in fact it always wins from that state because of incorrect play by the opponent. Classical optimization
methods for sequential decision problems, such as dynamic programming, can compute an optimal solution for
any opponent, but require as input a complete specification of that opponent, including the probabilities with
which the opponent makes each move in each board state. Let us assume that this information is not available
for this problem, as is the case for the vast majority of problems of practical interest. Such information can be
estimated from experience, in this case by playing many games against the opponent. About the best one can do
with this problem is to learn a model of the opponent's behavior up to some level of confhdence, and then apply
dynamic programming to compute an optimal solution given the approximate opponent model (Fig. 1.13).
#
x's move
o's move
A MA x's move
x's move
for certain species. Additionally, in extreme cases, diseased crops can produce toxins that result in seriou
health problems for consumers.
The following are reasons why this crop disease problem was chosen as a case study. Accurate diagnosi
was the best way to target the exact solutions necessary to maintain crop health. This diagnosis cannot be
done without deep subject matter expertise. Moreover, accurately describing a crop's symptoms to a plant
learning
Advanced image analytics: The mobile application uses Google's Cloud Vision API to analyze each crop's
color, size, texture, and decay patterns, then references these data points against a library of 50,000 images.
These images are classified into categories and labeled. the mobile application is
Machine learning: Through pattern-recognition machine-learning techniques,
trained to diagnose crop disease in near real-time.
model management, along with DevOps support
Data engineering: A reusable platform enables data and
data cleansing, learning, and service
for multi-cloud infrastructure to assist data scientists in performing
at scale.
deployment of solutions, utilizing artificial intelligence analytics techniques
of human
disease in the body. Machine learning can enhance the scientifhc understanding
any
health and of
signal provide a foundation for a new generation of precise medical diagnostic and treatment options:
firm, along with Microsoft works towards
Adaptive Biotechnologies, a Seattle based bio-technological
and machine learning with recent breakthroughs
coupling the latest advances in artificial intelligence
and decoding the human immune systct
biotechnology to build a practical technology for mapping
T h e goal o f this research is to "create a universal blood test that reads a person's i m m u n e system to u c
earliest stag
of diseases including infections,and autoimmune disorders in their
cancers,
a wide variety of such a univets
on human health
when they can be most effectively diagnosed and treated". The impact
to disease would be, in a word, transformational. ru
blood test that reads a persons exposure and response has
the immune system can reveal what diseases the body currently
is fighting or crem
Simply, sequencing what the immune sys
contains the key information needed to read
fought. A blood sample, therefore,
is currently detecting.
MULTIPLE-CHOICE QUESTIONS
15
Summary
Machine learning is an area in
computer science
which involves teaching computers to do Supervised, unsupervised and reintorce-
things ment
learning are
types of machine
learning
naturally by learning through experience. algorithms.
According to Tom M Mitchell, A computer Supervised learning is also called learning with
program is said to learn from experience (E) with
a tutor, builds a model with known
respect to some class of tasks (1) and performance input and
measure (P), if its performance at tasks in 7, as corresponding outputs.
measured by ? improves with experience E. Unsupervised learning algorithms try to identify
patternsfrom the input of data samples.
Machine learning lies at the intersection of com- Reinforcement learning is an area of machine
puter science, engineering, and statistics and
often appears in other disciplines.
learning inspired by behaviorist psychology,
concerned with how software
Recommendation systems, recognition systems, agents ought to
take actions in an environment so as to maxi-
classifiers and prediction systems are some of the mize some notion of cumulative
reward.
applications that use machine learning.
Multiple-Choice Questions
1. Suppose your email program watches your 4. A sofrware
way of marking the emails as spam or not. designed to evaluate whether a
customer account is hacked or not is an
and based on these observations learns how to Cxample of
better filter spam. The task Tin this case is
(a) Unsupervised learning
(a) Classifying emails as spam or not spam
(b) Supervised classification
(6) Watching you label emails as spam or not
(c) Supervised regression
spam
(d) None of the above
The number of emails correctly classified as
spam/or not spam 5. Which of the following
examples would be
(d) None of the above classified as an example of unsupervised learn-
2. A toy
ing algorithm?
shop wants to predict the number of i. Given email labeled
Barbie dolls which would be sold the next
as
spam/not spam,
learn a spam filter.
three months. What
type of problem is this? ii. Given a set of news articles found on the
(a) Unsupervised web. group them in articles under finance,
(b) Supervised movies, and political domain.
(c) Reinforcement ii. Given a database of customer data, automat-
(d) None of the above ically discover market segments and group
3. customers into different market
What kind of learning is segments.
required to group a set iv. Given a database of patients
of unlabeled dolls
as Barbie, Frozen, and Ochers? diagnosed as
(a) Unsupervised learning either having diabetes or not, learn to clas-
sily new patients as having diabetes or not.
(b) Supervised learning
(a) Both i and iv
(c) Reinforcement learning
(b) Both i and i
(d) None of the above
(c) Both ii and ii
(d) Both ii and iv
16 CHAPTER 1//NTRODUCTION TO MACHINE LEARNING
1. Explain machine learning with respect to (a) Establishing an appropriate algorithm that
would identify research groups working in
designing a chess game by identifying the tasks
(1), experience (E), and pertormance measure various domains.
(P). (b) Computing the returns on investment
2. Illustrate with a simple example how super- when the initial values of investments are EA
vised learning can be used in handling loan given.
defaulters. (c) Identifying whether a breast lump is malig-
3. Organize the following activities under super- nant or benign based on standard data
vised or unsupervised learning. State appropri sample taken from University of California
ate reasons for the same. Irvine reposito
4. Match the technique to the application.
Review Questions
Multiple-Choice Questions
1. (a) 2.(b) 3. (a) 4.(b) 5. (c)