lecture01 - introduction · 2019-11-19 · machine learning lecture 1 introduction dr. patrick chan...

25
Machine Learning Lecture 1 Introduction Dr. Patrick Chan [email protected] South China University of Technology, China 1 Dr. Patrick Chan @ SCUT Agenda Artificial Intelligence Machine Learning Types of ML Supervised Learning Unsupervised Learning Reinforcement Learning Machine Learning - Lecture01: Introduction 2

Upload: others

Post on 06-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Machine Learning

Lecture 1

Introduction

Dr. Patrick [email protected]

South China University of Technology, China

1

Dr. Patrick Chan @ SCUT

Agenda

Artificial Intelligence

Machine Learning

Types of ML

Supervised Learning

Unsupervised Learning

Reinforcement Learning

Machine Learning - Lecture01: Introduction2

Page 2: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Artificial Intelligence (AI)

AI has been usually found in the Hollywood Movie’s world

The TerminatorArtificial Intelligence

Avengers: Age of Ultrons

iRobotAlita: Battle Angel

Machine Learning - Lecture01: Introduction3

Dr. Patrick Chan @ SCUT

Artificial Intelligence Era

AI is everywhere nowadays

Machine Learning - Lecture01: Introduction4

Page 3: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Artificial Intelligence Impact

Ke Jie(3 – 0)

Sedol Lee(4 – 1)

5

AlphaGo Zero

without using data from human games, and stronger than any previous version

https://en.wikipedia.org/wiki/AlphaGo

https://deepmind.com/

(2017)

Machine Learning - Lecture01: Introduction

Dr. Patrick Chan @ SCUT

Artificial Intelligence Impact

https://en.wikipedia.org/wiki/OpenAI_Five

OpenAI Five (2018)

Dota 2 Bot

Defeat the professional team twice 99.4% win in 42,729 matches with public players

Machine Learning - Lecture01: Introduction6

Page 4: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Artificial Intelligence Impact

7https://www.research.ibm.com/artificial-intelligence/project-debater/live/

“We should subsidize preschool.”• Project Debater (Agree)• Harish Natarajan (Disagree)

Poll Agree Disagree Undecided

Before 79% 13% 8%

After 62% (-17%) 30% (+17%) 8%

58%: Project Debater better enriched their knowledge about the topic compared to Harish’s 20%

15 mins Preparation4 mins Opening statement4 mins Rebuttal2 mins Summary

IBM: Project Debater (2019)

Machine Learning - Lecture01: Introduction

Dr. Patrick Chan @ SCUT

Father of AI

The term “artificial intelligence” was coined in 1956 by American computer scientist John McCarthy

He defined AI as

– the science and

engineering of making

intelligent machines

Machine Learning - Lecture01: Introduction8

Page 5: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

AI Evaluation

How to evaluate an intelligent computer?

– The most famous method is

called Turing Test

– Invented by Alan M. Turing• English mathematician

• Logician and cryptographer

• 1912-1954

Machine Learning - Lecture01: Introduction9

The imitation game(2014)

Dr. Patrick Chan @ SCUT

AI Evaluation: Turing Test

Two contestants: Machine and Human

A human judge decides which is human and machine after chatting with them

To keep it fair, the conversation is usually text-based

If the judge is less than 50% accurate, the computer passes the test

Machine Learning - Lecture01: Introduction10

Page 6: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

AI vs Machine Learning (ML)

ML is powerful but not suitable for everything

Not everything can learn from data

Machine Learning - Lecture01: Introduction11

Artificial Intelligence

Machine Learning

Ability of a machine to think / act like humans do

E.g. Problem solving, reasoning, control, etc.

A machine to learn from examples without

being explicitly programmed

Dr. Patrick Chan @ SCUT

Machine Learning

What if a machine can learn…

Machine Learning - Lecture01: Introduction12

Page 7: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning

Arthur Samuel (1959): Machine Learning is the field of study that gives the computer the ability to learn without being explicitly programmed

American Pioneer in computer gaming and AI

1901 –1990

Machine Learning - Lecture01: Introduction13

Dr. Patrick Chan @ SCUT

Machine Learning

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.

By Tom Mitchell (1998)

American computer scientist

Carnegie Mellon University

1951 -

Machine Learning - Lecture01: Introduction14

Page 8: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning Model

Machine Learning - Lecture01: Introduction15

Algorithmor

Model

Experience

Evaluation Criteria

Goal

Data

Training

Evaluation

Dr. Patrick Chan @ SCUT

Machine Learning Model

Machine Learning - Lecture01: Introduction

Learning

Model

Evaluation

Reality

Database

Data

Algorithm

Data Collection

16

Page 9: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Classification Example

Salmon / Sea Bass

Real Life Example

A fish packing plantwants to automate the process of sorting incoming fishes (Salmon / Sea Bass) on a belt according to species

Machine Learning - Lecture01: Introduction17

?Sea bass

Salmon

?

Dr. Patrick Chan @ SCUT

Class (Salmon / Sea Bass)

Output

Machine Learning: Salmon / Sea Bass Example

Process

Machine Learning - Lecture01: Introduction18

Fish

Preprocessing (Isolate Fish, reduce noise…)

Image

Classification

Input Features

Feature Extraction (Take Measurement)

Refined Image

Sensing (camera)

Object

?

Page 10: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Process

Sensing

Digitize the object to the format which can be handled by machines

Preprocessing

Refine the data

E.g. lighting conditions, position of fish on the conveyor belt, camera noise, etc.

Machine Learning - Lecture01: Introduction19

Class

Object

Preprocessing

Classification

Feature Extraction

Sensing

?

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Process

Feature Extraction

What kind of information can distinguish one specie of fish from the other?

E.g. length, width, weight, number and shape of fins, tail shape, etc.

Experts may help

Classification

Many classification techniques (classifiers) available

Machine Learning - Lecture01: Introduction20

Class

Object

Preprocessing

Classification

Feature Extraction

Sensing

?

Page 11: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Feature Extraction

The expert (e.g. Fisherman) suggests salmon is usually shorter than sea bass

Length is chosen (as a feature) as a decision criterion

Machine Learning - Lecture01: Introduction21

?

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Feature Extraction

15 is selected as the threshold

Although sea bass is longer in general, there are many exceptions

The experts “may be” wrong!

How about other features?

E.g. lightness

Machine Learning - Lecture01: Introduction22

?

Histograms of the length feature

for sea bass and salmon

Sea BassSalmon

l*

Page 12: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Feature Extraction

Machine Learning - Lecture01: Introduction23

Histograms for the lightness feature

for sea bass and salmon

Sea BassSalmon

?

Try another feature “Lightness”

5.5 is selected as the threshold

“lightness” is better than “length”

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Cost Consideration

Besides accuracy, “costs of different errors” can be considered

Case 1: Company’s view Salmon is more expensive than sea bass.

Selling Salmon with the price of sea bass will be a loss

If salmon is classified as sea bass : HIGH cost

If sea bass is classified as salmon : LOW cost

Case 2: Customer’s view Customers who buy salmon will be upset if they get sea bass;

Customers who buy sea bass will not be upset if they get the more expensive salmon

If salmon is classified as sea bass : LOW cost

If sea bass is classified as salmon : HIGH cost

Machine Learning - Lecture01: Introduction24

?

Page 13: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Cost Consideration

Machine Learning - Lecture01: Introduction25

Sea BassSalmon

Sea BassSalmon

More seabass

Mistaken as salmon

?

Case 1: Company’s view

HIGH cost Salmon is classified as sea bass

LOW cost Sea bass is classified as salmon

Avoid classifying salmon wrongly by scarifying sea bass

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Cost Consideration

Machine Learning - Lecture01: Introduction26

Sea BassSalmon

?

Case 2: Customer’s view

LOW cost Salmon is classified as sea bass

HIGH cost Sea bass is classified as salmon

Avoid classifying sea bass wrongly by scarifying salmon

Sea BassSalmon

More salmon

Mistaken as seabass

Page 14: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Cost Consideration

Machine Learning - Lecture01: Introduction27

Sea BassSalmon

Sea BassSalmon Sea BassSalmon

Case 1 Case 2

More seabass

Mistaken as salmonMore salmon

Mistaken as seabass

?

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Multiple Features

Only ONE feature may not be good enough

More features should be considered

Two features: Lightness (x1), Width (x

2)

A fish is represented by a point in a 2D feature space:

Machine Learning - Lecture01: Introduction28

?

The two features (lightness and width)

for sea bass and salmon

Page 15: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Classifier

A decision boundary can be drawn to divide the feature space into two regions

Is it a linear classifier too simple?

Machine Learning - Lecture01: Introduction29

?

The two features (lightness and width)

for sea bass and salmon

Sea Bass

Salmon

What is this unseen fish?

?

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Classifier

Will other classifiers be better?

More complex classifier

Perfectly classify training samples

Ultimate objectiveis to classify unseen samplescorrectly

Can it be generalized to unseen sample?

Machine Learning - Lecture01: Introduction30

?

The two features (lightness and width)

for sea bass and salmon

?

Page 16: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Machine Learning: Salmon / Sea Bass Example

Classifier

Tradeoff between accuracy of training samples and complexity

Look more reasonable

Not too complex

Good in classifying the training samples

Machine Learning - Lecture01: Introduction31

?

The two features (lightness and width)

for sea bass and salmon

?

Dr. Patrick Chan @ SCUT

Key Factors in ML

Machine Learning - Lecture01: Introduction32

Learning Algorithm

Data

• Supervised Learning (Ch02-06)• Deep Learning (Ch07-09)• Transfer Learning and

Multi-task Learning (Ch12)• Unsupervised Learning (Ch13) • Reinforcement Learning (Ch14)

• Feature Selection and Extraction (Ch10)

• Sample Manipulation (Ch11)

Page 17: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Type of Learning

Machine Learning - Lecture01: Introduction33

Supervised Learning

Correct / Wrong

UnsupervisedLearning

No ground truth

ReinforcementLearning

Learn from reward

Dr. Patrick Chan @ SCUT

Learning Algorithm

Supervised Learning

Ground truth (desired output) is provided

A sample (x, y)

x: a feature vector

y: a desired output (e.g. label, value, …)

Learn the mapping between x and y

Predict y for an unseen x

Error can be measured explicitly

Machine Learning - Lecture01: Introduction34

Page 18: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Supervised Learning

Classification

y is a label of the sample

E.g. x = (Length, Weight)y = Seabass or Salmon

Machine Learning - Lecture01: Introduction35

Seabass Sample

Salmon Sample

Unseen Sample?

We

igh

t

Length

?

?

?

Dr. Patrick Chan @ SCUT

Learning Algorithm

Supervised Learning

Regression

y is a real number

E.g. x = (Length)y = Price of a fish

Machine Learning - Lecture01: Introduction36

A sample

Length

Price

?

Page 19: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Supervised Learning

Example

Machine Learning - Lecture01: Introduction37

(Classification)

Class

A bounding box

- Size and Coordination

- Class

For each bounding box

- Size and Coordination

- Class

For each bounding box

- Size and Coordination

- Class

- Which pixel is background?

(Regression)

(Classification)

(Regression)

(Classification)

(Regression)

(Classification)

(Classification)

Dr. Patrick Chan @ SCUT

Learning Algorithm

Unsupervised Learning

Only x is available

No desired output (y) is given

Find relation/structure/speciality of data

Never know how good your results are

Evaluation base on an assumption

Machine Learning - Lecture01: Introduction38

Page 20: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Unsupervised Learning

Clustering

Outlier Detection

Machine Learning - Lecture01: Introduction39

We

igh

t

LengthW

eig

ht

Length

Outlier

With labelled information Without labelled information

Dr. Patrick Chan @ SCUT

Learning Algorithm

Unsupervised Learning

Example: Customer Segmentation

Machine Learning - Lecture01: Introduction40

Page 21: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Reinforcement Learning

Learn from a reward or punishment, but not a teacher

Design a policy according to consequences of a sequence of actions

ReinforcementEncourage an action

PunishmentDiscourage an action(Negative Reinforcement)

Machine Learning - Lecture01: Introduction41

Dr. Patrick Chan @ SCUT

Learning Algorithm

Reinforcement Learning

An agent learns by interacting with the environment

Agent takes action and receives feedback in the form of rewards

No supervisor (to tell you right or wrong) but only reward

Machine Learning - Lecture01: Introduction42

Action (At)

State (St)

Reward (Rt)

Environment

Agent

Page 22: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Reinforcement Learning

Example

Machine Learning - Lecture01: Introduction43

Dr. Patrick Chan @ SCUT

Learning Algorithm

Deep Learning

Deep Learning, means Artificial Neural Network with a deep structure

Machine Learning - Lecture01: Introduction44

Simple Neural Network

Deep Neural Network

Page 23: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Deep Learning

Features does not rely on experts anymore

Machine Learning - Lecture01: Introduction45

Person ExpertDesigned

Features

. . .

Classification

Who?

Decision

Feature Extraction + ClassificationPerson

Who?

Decision

Deep

Learning

Traditional

Learning

Dr. Patrick Chan @ SCUT

Learning Algorithm

Transfer & Multi-Task Learning

Insufficient training samples

A few samples are available in some applications

E.g. Medical

Some algorithm requires lots of samples

E.g. Deep Learning

Can similar tasks share the knowledge?

Reduce demanding of resources, i.e. complexity and data

Machine Learning - Lecture01: Introduction46

Page 24: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Learning Algorithm

Transfer & Multi-Task Learning

Transfer Learning

Target task: a few samples

Source task: plenty of samples

Aim: accuracy of the target task

How to use source task to help target Task

Machine Learning - Lecture01: Introduction47

Source Task

Target

Task

Dr. Patrick Chan @ SCUT

Learning Algorithm

Transfer & Multi-Task Learning

Multi-Task Learning

A number of tasks

Aim: Accuracy of all tasks

Share knowledge to help each other

Machine Learning - Lecture01: Introduction48

Target

A

Target

B

Target

C

Page 25: Lecture01 - Introduction · 2019-11-19 · Machine Learning Lecture 1 Introduction Dr. Patrick Chan patrickchan@ieee.org South China University of Technology, China 1 Dr. Patrick

Dr. Patrick Chan @ SCUT

Data

Too much / few information

Contaminated information

Some information is useless

Some information is more useful

Machine Learning - Lecture01: Introduction49

Feature 1 Feature 2

Sample 1 0.2 3.2

Sample 2 4.3 2.3

Sample 3 5 1

Feature Selection and Extraction

Sample Manipulation

Dr. Patrick Chan @ SCUT

Key Factors in ML

Machine Learning - Lecture01: Introduction50

Learning Algorithm

Data

• Supervised Learning (Ch02-06)• Deep Learning (Ch07-09)• Transfer Learning and

Multi-task Learning (Ch12)• Unsupervised Learning (Ch13) • Reinforcement Learning (Ch14)

• Feature Selection and Extraction (Ch10)

• Sample Manipulation (Ch11)