Module 1
Module 1
TRACE KTU
CST413 Machine Learning
Syllabus
TRACE KTU
2
▷ Artificial intelligence (AI),ML ,Deep learning, and neural networks represent
incredibly exciting and powerful learning-based techniques used to solve many
real-world problems.
TRACE KTU
3
▷ Artificial intelligence (AI) is the broadest term used to classify
machines that mimic human intelligence.
▷ It is used to predict, automate, and optimize tasks that humans have
historically done, such as speech and facial recognition, decision
making, and translation.
TRACE KTU
4
What is Machine Learning
5
Machine Learning is...
6
What is Machine Learning Cont..
7
Definition of machine learning
▷ Arthur Samuel, an early American leader in the field of computer
gaming and artificial intelligence, coined the term “Machine Learning”
in 1959 while at IBM.
▷ He defined machine learning as “the field of study that gives computers
the ability to learn without being explicitly programmed.”
▷ Different authors define the term differently. We give below two more
TRACE KTU
definitions.
○ Machine learning is programming computers to optimize a
performance criterion using example data or past experience.
■ We have a model defined up to some parameters, and learning is the
execution of a computer program to optimize the parameters of the model
using the training data or past experience.
■ The model may be predictive to make predictions in the future, or
descriptive to gain knowledge from data, or both.
○ The field of study known as machine learning is concerned with
the question of how to construct computer programs that
automatically improve with experience.
8
Why “Learn” ?
▷ There is no need to “learn” to calculate payroll
▷ Learning is used when:
○ Human expertise does not exist (navigating on Mars),
○ Humans are unable to explain their expertise (speech
recognition)
TRACE KTU
○ Solution changes in time (routing on a computer network)
○ Solution needs to be adapted to particular cases (user
biometrics)
TRACE KTU
10
Slide credit: Geoffrey Hinton
Definition of learning
▷ Definition:
○ A computer program is said to learn from experience E with
respect to some class of tasks T and performance measure P, if its
performance at tasks T, as measured by P, improves with
experience E.
TRACE KTU
▷ Definition:
○ A computer program which learns from experience is called a
machine learning program or simply a learning program.
○ Such a program is sometimes also referred to as a learner.
11
▷ Examples:
i) Handwriting recognition learning problem
• Task T: Recognising and classifying handwritten words within
images
• Performance P: Percent of words correctly classified
• Training experience E: A dataset of handwritten words with given
TRACE KTU
classifications
ii) A robot driving learning problem
• Task T: Driving on highways using vision sensors
• Performance measure P: Average distance traveled before an error
• Training experience: A sequence of images and steering commands
recorded while observing a human driver.
12
What We Talk About, When We Talk About “Learning”
13
How machines learn
▷ Basic components of learning process:
○ The learning process, whether by a human or a machine, can be
divided into four components, namely, data storage, abstraction,
generalization and evaluation.
14
▷ Data storage:
○ Facilities for storing and retrieving huge amounts of data are an
important component of the learning process.
○ Humans and computers alike utilize data storage as a foundation
for advanced reasoning.
•
TRACE KTU
In a human being, the data is stored in the brain and data is
retrieved using electrochemical signals.
15
▷ Abstraction:
○ The second component of the learning process is known as
abstraction. Abstraction is the process of extracting knowledge
about stored data.
○ This involves creating general concepts about the data as a whole.
TRACE KTU
○ The creation of knowledge involves application of known models
and creation of new models.
○ The process of fitting a model to a dataset is known as training.
○ When the model has been trained, the data is transformed into an
abstract form that summarizes the original information.
16
▷ Generalization :
○ The third component of the learning process is known as
generalisation.
○ The term generalization describes the process of turning the
knowledge about stored data into a form that can be utilized for
future action.
TRACE KTU
○ These actions are to be carried out on tasks that are similar, but not
identical, to those what have been seen before.
○ In generalization, the goal is to discover those properties of the
data that will be most relevant to future tasks.
17
➢ Evaluation :
○ Evaluation is the last component of the learning process.
○ It is the process of giving feedback to the user to measure the
utility of the learned knowledge.
○ This feedback is then utilised to effect improvements in the whole
TRACE KTU
learning process.
18
Applications of machine learning
▪ Application of machine learning methods to large databases is called
data mining.
▪ In data mining, a large volume of data is processed to construct a
simple model with valuable use, for example, having high predictive
accuracy. The following is a list of some of the typical applications of
machine learning.
TRACE KTU
1. In retail business, machine learning is used to study consumer
behaviour. Eg: Market basket analysis, Customer relationship
management (CRM)
2. In finance, banks analyze their past data to build models to use in
credit applications, fraud detection, and the stock market.
3. In manufacturing, learning models are used for optimization,
control, and troubleshooting.
4. In medicine, learning programs are used for medical diagnosis.
5. In telecommunications, call patterns are analyzed for network
optimization and maximizing the quality of service.
19
6. In science, large amounts of data in physics, astronomy, and biology can only be analyzed fast
enough by computers.
7. In artificial intelligence, it is used to teach a system to learn and adapt to changes so that the
system designer need not foresee and provide solutions for all possible situations.
TRACE KTU
8. It is used to find solutions to many problems in vision, speech recognition, and robotics.
9. Machine learning methods are applied in the design of computer-controlled vehicles to steer
10. Machine learning methods have been used to develop programmes for playing games such as
chess, backgammon ..
11. Web mining: Search engines
20
Understanding data
▷ An important component of the machine learning process is data
storage,
▷ The different types and forms of data that are encountered in the
machine learning process.
▷ Unit of observation
○ By a unit of observation ,mean the smallest entity with measured
▷ Examples
TRACE KTU
properties of interest for a study.
21
▷ Examples and features :
○ Datasets that store the units of observation and their properties can
be imagined as collections of data consisting of the following:
TRACE KTU
○ An “example” is also referred to as an “instance”, or “case” or
“record.”
22
Examples for “examples” and “features”
▷ 1. Cancer detection:
○ Consider the problem of developing an algorithm for detecting
cancer.
○ (a) The units of observation are the patients.
○ (b) The examples are members of a sample of cancer patients.
TRACE KTU
○ (c) The following attributes of the patients may be chosen as the
features:
■ • gender • age • blood pressure • the findings of the pathology
report after a biopsy
23
▷ Pet selection:
○ Suppose we want to predict the type of pet a person will choose.
(a) The units are the persons.
(b) The examples are members of a sample of persons who own pets
(c) The features might include age, home region, family income, etc. of persons who
own pets.
TRACE KTU
24
Different forms of data
▷ 1. Numeric data:
○ If a feature represents a characteristic measured in numbers, it is
called a numeric feature.
▷ 2. Categorical or nominal:
○ A categorical feature is an attribute that can take on one of a
limited, and usually fixed, number of possible values on the basis
TRACE KTU
of some qualitative property. A categorical feature is also called a
nominal feature.eg:model-SEL,SE,SES
▷ 3. Ordinal data :
○ This denotes a nominal variable with categories falling in an
ordered list.
○ Examples include clothing sizes such as small, medium, and large,
or a measurement of customer satisfaction on a scale from “not at
all happy” to “very happy.”
25
TRACE KTU
26
TRACE KTU
27
TRACE KTU
28
TRACE KTU
29
Kinds of Machine Learning
▷ Supervised Learning
○ Classification (Logistic Regression, SVM, Naïve bayes, Decision
Trees,)
○ Regression (Linear regression, multi variate regression,
polynomial regression)
▷ TRACE KTU
○ Association learning
Unsupervised Learning
▷ Reinforcement Learning
30
Supervised Learning
▷
TRACE KTU
previous examples that are given.
Supervised learning is the machine learning task of
learning a function that maps an input to an output based
on example input-output pairs.(training data)
31
Supervised Learning
TRACE KTU
labeled data.
32
TRACE KTU
33
• Consider the following data regarding patients entering a clinic. The
data consists of the gender and age of the patients and each patient
is labeled as “healthy” or “sick”.
TRACE KTU
Based on this data, when a new patient enters the clinic, how
can one predict whether he/she is healthy or sick?
34
Supervised Learning
TRACE KTU
▷ If shape of object is rounded and depression at top
having color Red then it will be labelled as –Apple.
▷ If shape of object is long curving cylinder having color
Green-Yellow then it will be labelled as –Banana.
35
TRACE KTU
36
Supervised Learning
37
▷ pricr
TRACE KTU
Predicting actual price of
38
▷ Define supervised learning? Name special cases of
supervised learning depending on whether the
inputs/outputs are categorical, or continuous
TRACE KTU
39
GENERAL CLASSES OF MACHINE LEARNING PROBLEMS
○ TRACE KTU
Image belongs to cat /Dog
40
Classification
Score1 29 22 10 31 17 33 32 20
Score2 43 29 47 55 18 54 40 41
Result Pass Fail Fail Pass Fail Pass Pass Pass
TRACE KTU
▷ If we have some new data, say “Score1 = 25” and “Score2
= 36”, what value should be assigned to “Result”
corresponding to the new data?
41
▷ Discriminant:
○ A discriminant of a classification problem is a rule or a function
that is used to assign labels to new observations.
○ Examples i) Consider the data given and the associated
○ TRACE KTU
classification problem.
We may consider the following rules for the classification of the
new data:
○ IF Score1 + Score2 ≥ 60, THEN “Pass” ELSE “Fail”.
○ IF Score1 ≥ 20 AND Score2 ≥ 40 THEN “Pass” ELSE “Fail”
42
Classification
▷ There are several machine-learning algorithms for
classification. The following are some of the well-known
algorithms.
○ Logistic regression
○ Naive Bayes algorithm
○ k-NN algorithm
○ Decision tree algorithm
○ Support vector machine algorithm
TRACE KTU
○ Random forest algorithm
○ Examples:
○ Remarks
■ A classification problem requires that examples be classified into one of two or
more classes.
■ classification can have real-valued or discrete input variables.
■ A problem with two classes is often called a two-class or binary classification
problem.
■ A problem with more than two classes is often called a multi-class classification
problem.
43
Multi Class Classification
TRACE KTU
44
Multi Class Classification
46
Regression
○ the problem of predicting the value of a numeric variable based on
observed values of the variable.
○ The value of the output variable-number such as integer,floating point
value.
47
Regression
TRACE KTU
▷ The function f(x, θ) is called the regression function.
▷ Let X denote the car attributes and Y be the price of the car.
▷ The machine learning algorithm optimizes the parameters in the set θ
such that the approximation error is minimized our estimates are as
close as possible to the correct values given in the training set.
48
Different Regression models:
▷ There are various types of regression techniques available to make predictions.
○ Simple linear regression: There is only one continuous independent
variable x and the assumed relation between the independent variable and
the dependent variable y is
y = a + bx.
○ TRACE KTU
Multivariate linear regression: There are more than one independent
variable, say x1, . . . , xn, and the assumed relation between the
independent variables and the dependent variable is
y = a0 + a1x1 + ⋯ + an xn.
49
Regression
50
TRACE KTU
51
TRACE KTU
52
▷ Learning associations
○ Association rule learning:
■ is a machine learning method for discovering interesting
relations, called “association rules”, between variables in
large databases using some measures of “interestingness”.
TRACE KTU
○ Example Consider a supermarket chain.
○ The management of the chain is interested in knowing
whether there are any patterns in the purchases of products
by customers like the following:
■ “If a customer buys onions and potatoes together, then
he/she is likely to also buy hamburger.”
53
▷ Customer behaviour,
○ this defines an association between the set of products
{onion, potato} and the set {burger}.
○ This association is represented in the form of a rule as
follows:
○ {onion, potato} ⇒ {burger}
TRACE KTU
○ The measure of how likely a customer, who has bought
onion and potato, to buy burger also is given by the
conditional probability
■ P({onion, potato}∣{burger}).
○ If this conditional probability is 0.8,
TRACE KTU
○Suppose there is a customer who buys X and does not buy Y .
○Then that customer is a potential Y customer.
○Once we find such customers, we can target them for cross-selling.
A knowledge of such rules can be used for promotional pricing or
product placements.
55
Learning associations
▷ General case
▷ We are interested in learning a conditional probability of the form
P(Y|X) where Y is the product the customer may buy and X is the
TRACE KTU
product or the set of products the customer has already purchased.
56
Learning associations
57
TRACE KTU
58
Unsupervised Learning
59
Unsupervised Learning
TRACE KTU
60
Exercise 1
TRACE KTU
61
Supervised Learning
FRUIT
No. SIZE COLOR SHAPE
NAME
TRACE KTU
62
Supervised Learning
FRUIT
No. SIZE COLOR SHAPE
NAME
Rounded shape with
1 Big Red Apple
depression at the top
2 TRACE KTU
Small Red
Heart-shaped to nearly
globular
Cherry
63
Unsupervised Learning
▷ TRACE KTU
have no clue about those.
So, how will you arrange them?
▷ What will you do first???
▷ You will take a fruit and you will arrange them by
considering the physical character of that particular fruit.
64
Unsupervised Learning
65
Unsupervised Learning
66
TRACE KTU
67
▷ Clustering has a large no. of applications spread across
various domains.
Some of the most popular applications of clustering are:
○ Recommendation engines
○ Market segmentation
TRACE KTU
○ Social network analysis
○ Search result grouping
○ Medical imaging
○ Image segmentation
○ Anomaly detection
68
TRACE KTU
69
Reinforcement Learning
▷ TRACE KTU
context, to maximize its performance.
A reinforcement learning algorithm, or agent, learns by interacting
with its environment.
▷ The agent receives rewards by performing correctly and penalties
for performing incorrectly.
▷ The agent learns without intervention from a human by maximizing
its reward and minimizing its penalty.
70
TRACE KTU
71
Reinforcement Learning
73
▷ A good example is game playing where a single move by itself is not
that important; it is the sequence of right moves that is good.
○ A move is good if it is part of a good game playing policy.
▷ A robot navigating in an environment in search of a goal location is
another application area of reinforcement learning.
TRACE KTU
○ At any time, the robot can move in one of a number of directions.
○ After a number of trial runs, it should learn the correct sequence of
actions to reach to the goal state from an initial state, doing this as
quickly as possible and without hitting any of the obstacles.
▷ Other examples include
○ Adaptive Traffic signal optimization
○ Adaptive power grid
74
▷ The mathematical framework for defining a solution in reinforcement
learning scenario is called Markov Decision Process.
▷ This can be designed as:
○ • Set of states, S
○ • Set of actions, A
TRACE KTU
○ • Reward function, R
○ • Policy, π
○ • Value, V
▷ We have to take an action (A) to transition from our start state to our
end state (S).
▷ In return getting rewards (R) for each action we take.
▷ Our actions can lead to a positive reward or negative reward. The set of
actions we took define our policy (π) and the rewards we get in return
defines our value (V). Our task here is to maximize our rewards by
choosing the correct policy.
75
Semi-supervised learning
▷ Its an approach to machine learning that combines a small amount of
labeled data with a large amount of unlabeled data during training.
▷ Semi-supervised learning falls between unsupervised learning (with no
labeled training data) and supervised learning (with only labeled
training data).
▷ It is a special instance of weak supervision.
▷ TRACE KTU
Unlabeled data, when used in conjunction with a small amount of
labeled data, can produce considerable improvement in learning
accuracy.
▷ The acquisition of labeled data for a learning problem often requires a
skilled human agent (e.g. to transcribe an audio segment) or a physical
experiment (e.g. determining the 3D structure of a protein or
determining whether there is oil at a particular location).
76
▷ Practical applications of Semi-Supervised Learning
1. Speech Analysis: Since labeling of audio files is a very intensive
task, Semi Supervised learning is a very natural approach to solve this
problem.
TRACE KTU
2. Internet Content Classification: Labeling each webpage is an
impractical and unfeasible process and thus uses Semi-Supervised
learning algorithms.
Even the Google search algorithm uses a variant of Semi-Supervised
learning to rank the relevance of a webpage for a given query
77
Fruit Example:Supervised
Label/Target
○ Label/target
TRACE KTU
78
TRACE KTU
79
Introduction to Bayesian formulation.
TRACE KTU
80