INTRODUCTION TO
MACHINE LEARNING
Dr. Imran Khalil
[email protected] Meet the teacher
• Dr. Imran Khalil
• Assistant Professor
• Post Graduate Advisor
• Associate Head of Department
• BS (Information Technology) – 2002
• MBA (HR) – 2006
• MS (Computer Networks) – 2008
• Ph.D. (Theoretical Computer Sciences) – 2020
Energy Efficient Algorithms
• Research Areas
• Energy Efficient Algorithms
• Machine Learning, Deep Learning
• Optimization
• Geographical Load Balancing
• Geographically distributed Data Centers
• Cloud Computing 2
Contents
• What is machine learning?
• Types of Machine learning
• Supervised learning
• Unsupervised learning
• Reinforcement learning
• Prerequisite
• Class policy
• Grading Policy
• Recommended Books
3
What is Machine Learning?
4
Examples
An algorithm is a sequence of unambiguous instructions
for solving a problem, i.e., for obtaining a required output
for any legitimate input in a finite amount of time.
5
6
7
8
9
10
11
12
13
14
15
What is Machine Learning?
Field of study that gives
computers the ability to learn
without being explicitly
programmed.
Arthur Samuel (1959)
16
What is Machine Learning?
ML is a subset of AI which provides machines the ability to learn automatically
& improve from experience without being explicitly programmed.
17
Questions
If the checkers program had been allowed to play only ten
games (instead of tens of thousands) against itself, a much
smaller number of games, how would this have affected its
performance?
❑ Would have made it better
❑ Would have made it worse
18
Types of Machine Learning
19
20
Supervised Learning
Learns from being given “right answer”
21
𝐈𝐧𝐩𝐮𝐭 (𝒙) 𝐎𝐮𝐭𝐩𝐮𝐭 (𝒚) 𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
email Spam?(0/1) Spam filtering
Audio clip Text transcripts Speech recognitions
English Urdu Machine translation
Ad, user info Click? (0/1) Online advertising
Image, radar info. Position of other cars Self driving car
Image of phone Defect (0/1) Visual inspection
22
Regression: Housing Price Prediction
23
Regression: Housing Price Prediction
24
Regression: Housing Price Prediction
25
Supervised Learning
• Given
• Data set of houses
• For each house, given correct size and price
• Objective
• For an unseen size of the house, what is the price?
• Also called a “Regression Problem”
• Predict continuous valued output (Price)
Regression predict a number infinitely many possible outputs
26
Classification: Cancer Detection
Machine Learning Question
Given the tumor size, what is the probability that the tumor is malignant?
27
Supervised Learning
• Machine Learning Question
• Given the tumor size, what is the probability that the tumor is
malignant or benign?
• Classification Problem
• Discrete Valued Output (0 or 1)
• In classification problem, can have
• A discrete number of possible values for the output
• 0: Benign
• 1: Type 1
• 2: Type 2
• 3: Type 3
Classification predict categories of small number (finite) of possible outputs
28
Classification: Cancer Detection - Two or
more features
• Other attributes can also be added
• Thickness of the tumor
• Uniformity of cell size
• Uniformity of cell shape, etc.
• More features can be added 29
Supervised Learning
30
Question
• You are running a company, and you want to develop learning
algorithm to address each of two problems
1. You have a large inventory of identical items. You want to
predict how many of these items will sell over the next 3
months.
2. You’d like software to examine individual customer
accounts, and for each account decide if it has been
hacked/compromised.
• Should you treat these as classification or as regression
problems?
31
32
Unsupervised Learning
33
Iris unlabelled dataset
34
Unsupervised Learning
Supervised learning learn from data labeled with the “right answers”
35
Unsupervised Learning
Unsupervised learning find something interesting in unlabeled data.
36
Unsupervised Learning
• Given
• A data set
• No information about the structure or output
• Output
• Find structure in the data
• Unsupervised learning algorithm
• Decide on the structure of the data
37
Unsupervised Learning
The unsupervised learning clusters the data in two groups
38
Unsupervised Learning - Clustering
Screen grab from news.google.com (July 06, 2023)
39
Unsupervised Learning - Clustering
Screen grab from news.google.com (Jan. 02, 2025)
40
Data Centers - Clustering
• 2016 Estimates:
• A Gartner report from July 2016
estimated that Google had
approximately 2.5 million
servers at that time.
• How Many Google Searches Per
Day (2025 Statistics)
• More than 99,000 queries
processed each second
• 8.5 billion Google searches are
made every day.
41
Astronomical Data Analysis - Clustering
42
Social Network Analysis - Clustering
43
Unsupervised Learning - Clustering
• Genomics - Microarray data
• Have a group of individuals
• On each measure expression of a gene
• Run algorithm to cluster individuals into types of people. 44
Question
Of the following examples, which would you address using an
unsupervised learning algorithm?
1. Given email as spam/not-spam, learn a spam filter.
2. Given a set of new articles found on the web, group them into
set of articles about the same story.
3. Given a database of customer data, automatically discover
market segments and group customers into different market
segments.
4. Given a data set of patients diagnosed as either having diabetes
or not, learn to classify new patients as having diabetes or not.
45
46
Reinforcement Learning :: Introduction
47
Reinforcement Learning :: Introduction
48
Reinforcement Learning :: Introduction
49
Reinforcement Learning :: Introduction
• A reinforcement learning model will learn from its
experience and over time will be able to identify which
actions lead to the best rewards.
• In Reinforcement Learning (RL), agents are trained on
a reward and punishment mechanism. The agent is rewarded
for correct moves and punished for the wrong ones. In doing
so, the agent tries to minimize wrong moves and maximize
the right ones.
50
Application of Reinforcement Learning
• Self Driving Car (Autonomous Driving)
• Factory Optimization
• Financial (Stock) Trading
• Playing Games
51
Application of Reinforcement Learning
• Self Driving Car (Autonomous Driving)
52
Application of Reinforcement Learning
• Industry Automation (Industry Optimization)
53
Application of Reinforcement Learning
• Stock (Financial) Trading
54
Application of Reinforcement Learning
• Playing Games
55
Prerequisite
• Core Computer Science Knowledge
• Statistics & Probability
• Linear Algebra & Calculus
56
Tools
• Python
• Install Jupyter Notebook
57
Class Policy
• Attendance, as per the university policy.
• IF Attendance < 75% THEN SET Allow In Exam = FALSE.
• No relaxation.
• No mobile phones!!!
58
Grading Policy
• Sessional = 25%
• Assignments
• Quizzes
• Class Attendance
• Presentations/Semester Project etc.
• Mid Term = 25%
• Final Term = 50%
59
Acknowledgment
• Material presented in these lecture slides is obtained from Prof. Dr.
Andrew Ng course on Machine Learning
• Dr. Iftikhar Ahmad’s lecture slides were consulted for assistance.
• .
60