You are on page 1of 33

EE2211 Introduction to

Machine Learning
Lecture 1

Wang Xinchao
xinchao@nus.edu.sg

!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Course Contents
• Introduction and Preliminaries (Xinchao)
– Introduction
– Data Engineering
– Introduction to Probability and Statistics
• Fundamental Machine Learning Algorithms I (Helen)
– Systems of linear equations
– Least squares, Linear regression
– Ridge regression, Polynomial regression
• Fundamental Machine Learning Algorithms II (Thomas)
– Over-fitting, bias/variance trade-off
– Optimization, Gradient descent
– Decision Trees, Random Forest
• Performance and More Algorithms (Xinchao)
– Performance Issues
– K-means Clustering
– Neural Networks
2
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
World’s Largest Selfie

3
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
World’s Largest Selfie

4
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Outline
• What is machine learning?
• When do we need machine learning?
• Applications of machine learning
• Types of machine learning
• Walking through a toy example on classification
• Inductive vs. Deductive Reasoning

5
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
What is machine learning?

Learning is any process by which a system


improves performance from experience.
- Herbert Simon

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 in T, as measured
by P, improves with experience E.
- Tom Mitchell
6
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Machine Learning vs Traditional Approach

Traditional Approach

Data
Computer Output
Program
Hard-coded

Machine Learning

Data
Computer Program
Output Learned

Machine Learning: field of study that gives computers the


ability to learn without being explicitly programmed
- Arthur Samuel

7
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
AI, Machine Learning, and
Deep Learning

8
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
• Human expertise does not exist (navigating on Mars)
When
• Humans do can’t
we explain
need their
machine
expertiselearning?
(speech recognition)
• Models must be customized (personalized medicine)
Lack of human expertise Models must be customized
Modelsonare
•(Navigating based
Mars) on huge amounts
(Personalized of data (genomics)
Medicine)

Involves huge amount of data forawelldefinedcasesuchas


Learning isn’t
(Genomics) always useful: ifformulas aregiven
Learning is not always useful:
• There is no need to “learn” to calculate payroll
5
Based on slide by E. Alpaydin No need to “learn” to calculate
payroll!

9
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Application of Machine Learning
A classic example of a task that requires machine learn
Task T, Performance P, Experience E
It is very hard to say what makes a 2

T: Digit Recognition
P: Classification Accuracy
E: Labelled Images

Labels -> Supervision!

Slide credit: Geoffrey Hinton

10
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Application of Machine Learning

Task T, Performance P, Experience E

T: Email Categorization
P: Classification Accuracy
E: Email Data, Some Labelled

11
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Application of Machine Learning

Task T, Performance P, Experience E

T: Playing Go Game
P: Chances of Winning
E: Records of Past Games

12
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Application of Machine Learning

Task T, Performance P, Experience E

T: Identifying Covid-19 Clusters


P: Small Internal Distances
Larger External Distances
E: Records of Patients

13
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Web Search Engine Product Recommendation Language Translation

Photo Tagging Virtual Personal Assistant Portfolio Management

Traffic Prediction Medical Diagnosis


Algorithmic Trading
14
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Types of Machine Learning

Supervised Learning Unsupervised Learning Reinforcement Learning


Input: Input:
1) Training Samples, Input: Sequence of States,
2) Desired Output Samples Actions, and
(Teacher/Supervision) Delayed Rewards
Output:
Output: Underlying patterns in Output:
A rule that maps input to data Action Strategy: a rule
output that maps the
environment to action

15
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Types of Machine Learning

Supervised Learning Unsupervised Learning Reinforcement Learning


Input: Input:
1) Training Samples, Input: Sequence of States,
2) Desired Output Samples Actions, and
(Teacher/Supervision) Delayed Rewards
Output:
Output: Underlying patterns in Output:
A rule that maps input to data Action Strategy: a rule
output that maps the
environment to action

16
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Supervised output
Learning % Regression # (Continuous)

% Classification # (Categorical)

• Given !!, #! , ! ", #" , …, ! # , ##


Regression • Learn a function $ ! to predict real-valued # given !

Arctic Sea Ice Extent in January (in million sq km) Acrtic Sea Ice Extent in January (in million sq km)
16 16

15.5 15.5

15 15

# 14.5
#
14.5
! " : line that best aligns
14 14 with samples
13.5 13.5

13 13

12.5 12.5
1970 1980 1990 2000 2010 2020 2030 1970 1980 1990 2000 2010 2020 2030

% %

17
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Supervised
Learning % Regression # (Continuous)

% Classification # (Categorical)

• Given !!, #! , ! ", #" , …, ! # , ##


Classification • Learn a function $ ! to predict categorical # given !

width width
# = Sea Bass # = Sea Bass
Feature !! !!
Space
!" !" ?

# = Salmon # = Salmon
lightness lightness
$ % : line that separates
two classes
18
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Types of Machine Learning

Supervised Learning Unsupervised Learning Reinforcement Learning


Input: Input:
1) Training Samples, Input: Sequence of States,
2) Desired Output Samples Actions, and
(Teacher/Supervision) Delayed Rewards
Output:
Output: Underlying patterns in Output:
A rule that maps input to data Action Strategy: a rule
output that maps the
environment to action

19
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Unsupervised Learning

• Given !!, ! ", …, ! # , without labels


Clustering • Output Hidden Structure Behind

!! !!

!" !"

20
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Types of Machine Learning

Supervised Learning Unsupervised Learning Reinforcement Learning


Input: Input:
1) Training Samples, Input: Sequence of States,
2) Desired Output Samples Actions, and
(Teacher/Supervision) Delayed Rewards
Output:
Output: Underlying patterns in Output:
A rule that maps input to data Action Strategy: a rule
output that maps the
environment to action

21
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Reinforcement Learning
Breakout Game

Initial Performance Training 15 minutes Training 30 minutes

22
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Reinforcement Learning
• Given sequence of states ! and actions " with (delayed)
rewards #
• Output a policy $(&, (), to guide us what action & to take in
state (

%: Ball Location,
Paddle Location, Bricks

#: left, right

&:
positive reward
Knocking a brick,
clearing all bricks

negative reward
Missing the ball

zero reward
Cases in between

23
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Supervised
Unsupervised Quiz Time!
Reinforcement
A classic example of a task that requires machine learning:
It is very hard to say what makes a 2

6
Slide credit: Geoffrey Hinton

Supervised Unsupervised

Supervised
Reinforcement

24
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Walking Through A Toy Example:
Token Classification

? Yes

?
Yes No

Step1: Feature Extraction Step2: Sample Classification


Extract Attributes of Samples Decide Label for a Sample

25
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Walking Through A Toy Example:
Token Classification
B,L,Ring R,L,Triangle
B,L,Rectangle
Y,S,Arrow

? Yes

G,S,Circle
G,S,Diamond ?
R,L,Circle
Y,L,Triangle
O,L,Diamond No
Yes testingsample

Step 1: Feature Extraction


Color, Size, Shape

26
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Walking Through A Toy Example:
Token Classification

Feature Extraction
Color Size Shape Label
Blue Large Ring Yes
Red Large Triangle Yes
Orange Large Diamond Yes
Green Small Circle Yes
Yellow Small Arrow No
Blue Large Rectangle No
Red Large Circle No
Green Small Diamond No
Yellow Large Triangle ?

27
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Walking Through A Toy Example:
Token Classification

Feature Extraction Similarity


Color Size Shape Label Color Size Shape Total
Blue Large Ring Yes 0 1 0 1
Red Large Triangle Yes 0 1 1 2
Orange Large Diamond Yes 0 1 0 1
Green Small Circle Yes 0 0 0 0
Yellow Small Arrow No 1 0 0 1
Blue Large Rectangle No 0 1 0 1
Red Large Circle No 0 1 0 1
Green Small Diamond No 0 0 0 0

29
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Walking Through A Toy Example:
Token Classification

Similarity
Color Size Shape Total
Nearest Neighbor Classifier:
0 1 0 1
0 1 1 2 1) Find the “nearest
0 1 0 1 neighbor” of a sample in
the feature space
0 0 0 0
1 0 0 1 2) Assign the label of the
0 1 0 1 nearest neighbor to the
sample
0 1 0 1
0 0 0 0

30
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Inductive vs. Deductive Reasoning
• Main Task of Machine Learning: to make inference
Two Types of Inference

Inductive Deductive

• To reach logical conclusions


• To reach probable conclusions deterministically
• Not all needed information is • All information that can lead to
available, causing uncertainty the correct conclusion is
available

Probability and Statistics Rule-based reasoning


it as b b c then as c

31
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Inductive Reasoning
Note: humans use inductive reasoning all the time and
not in a formal way like using probability/statistics.

Ref: Gardener, Martin (March 1979). "MATHEMATICAL GAMES: On the fabric of


inductive logic, and some probability paradoxes" (PDF). Scientific American. 234
32
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
Summary by Quick Quiz

Three Components in ML Definition


Task T, Performance P, Experience E

Two Types of Supervised Learning


Classification, Regression
Three Types of in ML
Supervised Learning
Unsupervised Learning
One Type of Unsupervised Learning
Reinforcement Learning
Clustering

Inductive and Deductive


Example of a Classifier Model
Inductive: Probable Nearest Neighbor Classifier
Deductive: Rule-based

33
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"
34
!"#$%&'()*+",,-"./01"233"4()*+5"4656'7681"

You might also like