machine learning and classification app · z v ^^/dd/e' _ / ( z z d ð v z e ñ ... microsoft...

35
Machine Learning & Deep Learning with MATLAB Phitcha Phitchayanon Applications Engineer [email protected]

Upload: others

Post on 18-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Machine Learning & Deep Learning with MATLAB

Phitcha PhitchayanonApplications [email protected]

Page 2: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Agenda

Part I: Introduction to Machine Learning• Overview of Machine Learning• Machine Learning Algorithms• Demo: Detecting Human Activity

Part II: Introduction to Deep Learning• Why Deep Learning• Deep Learning vs Machine Learning• Demo: Object classification with ALEXNET

Key takeawaysQ&A

2

Page 3: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

AI100

1010111001

ML

DL

The simulated intelligence that tries to mimic human actions or decision making.

The use of statistical methods that enables computer to learn from data without explicitly programmed to do so.

A subfield of machine learning that uses multi-layer neural networks in the architecture

Artificial Intelligence (AI), Machine Learning (ML), and Deep Learning (DL)

3

Page 4: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Machine Learning

Use features in the data and to create a predictive model

Most common tool for Data analytics modelling

4

Page 5: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Used Across Many Application Areas

BiologyImage & Video ProcessingAgriculture Energy

Tumor Detection, Drug Discovery

Load, Price Forecasting, Trading

Pattern Recognition

Predictive Maintenance & Forecasting

5

Page 6: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Motivation for Machine Learning• Do you want to create a model of a system?

- Understand dynamics- Predict Outputs

• How do you create model?- Develop an equation

• Takes time to develop, sometimes even years

• Unknown if there is actually an equation at all

• Another option, Machine Learning

6

Page 7: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Overview – Machine Learning

Machine Learning

Supervised Learning

Unsupervised Learning

Group and interpret data based only on input data

Types of Learning

Develop predictivemodel based on both input and output data

Clustering

Categories of Algorithms

Regression

Classification

7

Page 8: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Unsupervised Learning

Clustering

k-Means, Fuzzy C-Means

Hierarchical

Neural Networks

Gaussian Mixture

Hidden Markov Model

8

Page 9: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Supervised Learning

Neural Networks

Decision Trees Ensemble Methods

Non-linear reg. (GLM,

Logistic)

Regression

Support Vector Machines

Discriminant Analysis Naïve Bayes Nearest

Neighbor

Linear Regression

Classification

9

Page 10: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Supervised Learning Workflow

MODEL

PREDICTION

Train: Iterate till you find the best model

Predict: Integrate trained models into applications

MODELSUPERVISEDLEARNING

CLASSIFICATION

REGRESSION

PREPROCESS DATA

SUMMARYSTATISTICS

PCAFILTERS

CLUSTER ANALYSIS

LOAD DATA

PREPROCESS DATA

SUMMARYSTATISTICS

PCAFILTERS

CLUSTER ANALYSIS

NEWDATA

MODELPREPROCESS DATA

SUMMARYSTATISTICS

PCAFILTERS

CLUSTER ANALYSIS

10

Page 11: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Machine Learning

Machine learning uses data and produces a program to perform a task

Standard Approach Machine Learning Approach

𝑚𝑜𝑑𝑒𝑙 = < 𝑴𝒂𝒄𝒉𝒊𝒏𝒆𝑳𝒆𝒂𝒓𝒏𝒊𝒏𝒈

𝑨𝒍𝒈𝒐𝒓𝒊𝒕𝒉𝒎>(𝑠𝑒𝑛𝑠𝑜𝑟_𝑑𝑎𝑡𝑎, 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦)

ComputerProgram

MachineLearning

𝑚𝑜𝑑𝑒𝑙: Inputs → OutputsHand Written Program Formula or Equation

If X_acc > 0.5then “SITTING”

If Y_acc < 4 and Z_acc > 5then “STANDING”

𝑌

= 𝛽 𝑋 + 𝛽 𝑌+ 𝛽 𝑍 +

Task: Human Activity Detection

11

Page 12: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Demo 1: Human Activity Learning Using Mobile Phone Data

Objective: Train a classifier to classify human activity from sensor data

Data:

Approach:• Extract features from raw sensor signals• Train and compare classifiers• Test results on new sensor data

Predictors 3-AxialAccelerometer and Gyroscope

Response Activity:

12

Page 13: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with the Classification Learner App

1. Data import and Cross-validation setup

Classification Learner App with data: Step 1

13

Page 14: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with Classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

Classification Learner App with data: Step 2

14

Page 15: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with the Classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

3. Train multiple models

Classification Learner App with data: Step 3

15

Page 16: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with Classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

3. Train multiple models

Classification Learner App with data: Step 3 cont’d

16

Page 17: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with the Classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

3. Train multiple models

Classification Learner App with data: Step 3 cont’d

17

Page 18: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with the Classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

3. Train multiple models

4. Model comparison and assessment

Classification Learner App with data: Step 4

18

Page 19: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with Classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

3. Train multiple models

4. Model comparison and assessment

5. Share model

Classification Learner App with data: Step 5

19

Page 20: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Train a Model with the classification Learner App

1. Data import and Cross-validation setup

2. Data exploration and feature selection

3. Train multiple models

4. Model comparison and assessment

5. Share model or automate process

Classification Learner App with data: Step 5 Cont’d

20

Page 21: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

21

28*28 1000*1000

Page 22: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

22

Deep Learning

Page 23: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Deep Learning

Definition: Deep learning is a machine learning technique that learns features and tasks directly from data.

Data can be images, text or sound.

23

Page 24: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

HumanAccuracy

Why is Deep Learning So Popular Now?

Source: ILSVRC Top-5 Error on ImageNet 24

Page 25: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

GPU

Factors promoting Deep Learning

25

Page 26: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Machine Learning vs Deep Learning

Traditional Machine Learning approach

Machine Learning

ClassificationTraditional Feature Extraction

Boy Dog

Bicycle

Deep Learning approach

…𝟗𝟓%𝟑%

𝟐%

Boy Dog

Bicycle

Convolutional Neural Network (CNN)

Learned featuresEnd-to-end learning

Feature learning + Classification

26

Page 27: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Machine Learning vs Deep Learning

Question: Machine Learning or Deep Learning?

27

Page 28: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Neural Network

28

Page 29: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Multilayer Neural Network

29

Page 30: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

ALEXNET

30

Page 31: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Classification with 11 lines of codes

%% Get Webcamwebcaminfo = webcamlist;vid = webcam(webcaminfo{2});% preview(vid)

%% Define Alexnetnet = alexnet;

while true im = snapshot(vid);image(im)im = imresize(im,[227 227]);label = classify(net,im);title(string(label))drawnow

end

31

Page 32: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

32

Page 33: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

33

Page 34: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

Documentation mathworks.com/machine-learning

Training

Additional Resources

34

Page 35: Machine Learning and Classification App · Z v ^^/dd/E' _ / ( z z D ð v z E ñ ... Microsoft PowerPoint - Machine Learning and Classification App Author: SukanyaWongbandit Created

See you next timeThank you

35