machine learning made easy€¦ · machine learning –what is machine learning and why do we need...

19
1 © 2015 The MathWorks, Inc. Machine Learning Made Easy David Willingham Senior Application Engineer

Upload: others

Post on 07-Aug-2020

35 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

1© 2015 The MathWorks, Inc.

Machine Learning Made Easy

David Willingham

Senior Application Engineer

Page 2: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

2

Machine Learning

– What is Machine Learning and why do we need it?

– Common challenges in Machine Learning

Example 1: Human activity learning using mobile phone data

– Learning from sensor data

Example 2: Real-time car identification using images

– Learning from images

Summary & Key Takeaways

Agenda

Page 3: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

3

Machine Learning is Everywhere

Image Recognition

Speech Recognition

Stock Prediction

Medical Diagnosis

Data Analytics

Robotics

and more…

[TBD]

Page 4: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

4

Machine Learning

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

Standard Approach Machine Learning Approach

𝑚𝑜𝑑𝑒𝑙 = <𝑴𝒂𝒄𝒉𝒊𝒏𝒆𝑳𝒆𝒂𝒓𝒏𝒊𝒏𝒈𝑨𝒍𝒈𝒐𝒓𝒊𝒕𝒉𝒎

>(𝑠𝑒𝑛𝑠𝑜𝑟_𝑑𝑎𝑡𝑎, 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦)

Computer

Program

Machine

Learning

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

If X_acc > 0.5

then “SITTING”

If Y_acc < 4 and Z_acc > 5

then “STANDING”

𝑌𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦= 𝛽1𝑋𝑎𝑐𝑐 + 𝛽2𝑌𝑎𝑐𝑐+ 𝛽3𝑍𝑎𝑐𝑐 +

Task: Human Activity Detection

Page 5: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

5

Example: Human Activity Learning Using Mobile Phone Data

Machine

Learning

Data:

3-axial Accelerometer data

3-axial Gyroscope data

Page 6: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

6

“essentially, all models are wrong,

but some are useful”

– George Box

Page 7: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

7

Challenges in Machine LearningHard to get started

Steps Challenge

Access, explore and analyze

dataData diversity

Numeric, Images, Signals, Text – not always tabular

Preprocess dataLack of domain tools

Filtering and feature extraction

Feature selection and transformation

Train modelsTime consuming

Train several models to find the “best”

Assess model performanceAvoid pitfalls

Over Fitting

Speed-Accuracy-Complexity tradeoffs

Iterate

Page 8: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

8

MODEL

PREDICTION

Machine Learning Workflow

Train: Iterate till you find the best model

Predict: Integrate trained models into applications

MODELSUPERVISED

LEARNING

CLASSIFICATION

REGRESSION

PREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

LOAD

DATAPREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

NEW

DATA

Page 9: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

9

Machine Learning

– What is Machine Learning and why do we need it?

– Common challenges in Machine Learning

Example 1: Human activity learning using mobile phone data

– Learning from sensor data

Example 2: Real-time car identification using images

– Learning from images

Summary & Key Takeaways

Agenda

Page 10: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

10

Example 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-axial Accelerometer and

Gyroscope data

Response Activity:

Page 11: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

11

PREDICTIONMODEL

Machine Learning Workflow for Example 1

Train: Iterate till you find the best model

Predict: Integrate trained models into applications

MODELSUPERVISED

LEARNING

CLASSIFICATION

REGRESSION

PREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

LOAD

DATA

PREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

TEST

DATA

1. Mean

2. Standard

deviation

3. PCA

Classification

Learner

1. Mean

2. Standard

deviation

3. PCA

Page 12: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

12

Machine Learning

– What is Machine Learning and why do we need it?

– Common challenges in Machine Learning

Example 1: Human activity learning using mobile phone data

– Learning from sensor data

Example 2: Real-time car identification using images

– Learning from images

Summary & Key Takeaways

Agenda

Page 13: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

13

Example 2: Real-time Car Identification Using Images

Objective: Train a classifier to identify car

type from a webcam video

Data:

Approach:

– Extract features using Bag-of-words

– Train and compare classifiers

– Classify streaming video from a webcam

Predictors Several images of cars:

Response NIGEL, LIGHTNING, SANDDUNE, MATER

Page 14: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

14

PREDICTIONMODEL

Machine Learning Workflow for Example 2

Train: Iterate till you find the best model

Predict: Integrate trained models into applications

MODELSUPERVISED

LEARNING

CLASSIFICATION

REGRESSION

PREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

LOAD

DATA

PREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

WEBCAM

1. Build Bag-of-

features

2. Encode images

as new features

Classification

Learner

Encode images as

new features

Page 15: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

15

Machine Learning

– What is Machine Learning and why do we need it?

– Common challenges in Machine Learning

Example 1: Human activity learning using mobile phone data

– Learning from sensor data

Example 2: Real-time car identification using images

– Learning from images

Summary & Key Takeaways

Agenda

Page 16: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

16

MATLAB Strengths for Machine Learning

Steps Challenge Solution

Accessing, exploring and

analyzing dataData diversity

Extensive data supportImport and work with signal, images, financial,

Textual, geospatial, and several others formats

Preprocess data Lack of domain toolsHigh-quality libraries

Industry-standard algorithms for Finance, Statistics, Signal,

Image processing & more

Train models Time consuming Interactive, app-driven workflows

Focus on machine learning, not programing

Assess model

performance

Avoid pitfallsOver Fitting,

Speed-Accuracy-Complexity

Integrated best practicesModel validation tools built into app

Rich documentation with step by step guidance

IterateFlexible architecture for customized workflows

Complete machine learning platform

Challenges in Machine Learning

Page 17: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

17

Consider Machine Learning when:

– Hand written rules and equations are too complex

Face recognition, speech recognition, recognizing patterns

– Rules of a task are constantly changing

Fraud detection from transactions, anomaly in sensor data

– Nature of the data changes and the program needs to adapt

Automated trading, energy demand forecasting, predicting shopping trends

MATLAB for Machine Learning Email me if you have further questions

Key Takeaways

Page 18: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

18

Additional Resources

Documentation: mathworks.com/machine-learning

Page 19: Machine Learning Made Easy€¦ · Machine Learning –What is Machine Learning and why do we need it? –Common challenges in Machine Learning Example 1: Human activity learning

19

Q & A