machine learning for predictive modelling...machine learning machine learning uses data and produces...

24
1 Β© 2015 The MathWorks, Inc. Machine Learning for Predictive Modelling Rory Adams

Upload: others

Post on 07-Aug-2020

35 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

1Β© 2015 The MathWorks, Inc.

Machine Learning for Predictive Modelling

Rory Adams

Page 2: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

2

Machine Learning

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

– Common challenges in Machine Learning

Example: Human activity learning using mobile phone data

Example: Real-time object identification using images

Example: Load forecasting using weather data

Summary & Key Takeaways

Agenda

Page 3: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

3

Machine Learning is Everywhere

Image Recognition

Speech Recognition

Stock Prediction

Medical Diagnosis

Data Analytics

Robotics

and more…

[TBD]

Page 4: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

4

Machine Learning

Machine learning uses data and produces a model 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

π‘šπ‘œπ‘‘π‘’π‘™: Predictors β†’ Response

Page 5: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

5

Different Types of Learning

Machine Learning

Supervised Learning

Classification

Regression

Unsupervised Learning

β€’ Discover a good internal representation

β€’ Learn a low dimensional representation

β€’ Response is a continuous number

(temperature, stock prices).

β€’ Response is a choice between classes

β€’ (True, False) (Red, Blue, Green)

Page 6: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

6

Example: Human Activity Learning Using Mobile Phone Data

Machine

Learning

Data:

3-axial Accelerometer data

3-axial Gyroscope data

Page 7: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

7

β€œessentially, all models are wrong,

but some are useful”

– George Box

Page 8: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

8

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 many models to find the β€œbest”

Assess model performanceAvoid pitfalls

Over Fitting

Speed-Accuracy-Complexity tradeoffs

Iterate

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 many models to find the β€œbest”

Assess model performanceAvoid pitfalls

Over Fitting

Speed-Accuracy-Complexity tradeoffs

Iterate

Page 9: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

9

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

PREPROCESS

DATA

SUMMARY

STATISTICS

PCAFILTERS

CLUSTER

ANALYSIS

MODEL

Page 10: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

10

Machine Learning

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

– Common challenges in Machine Learning

Example: Human activity learning using mobile phone data

Example: Real-time object identification using images

Example: Load forecasting using weather data

Summary & Key Takeaways

Agenda

Page 11: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

11

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:

(Classification)

Page 12: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

12

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 13: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

13

Machine Learning

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

– Common challenges in Machine Learning

Example: Human activity learning using mobile phone data

Example: Real-time object identification using images

Example: Load forecasting using weather data

Summary & Key Takeaways

Agenda

Page 14: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

14

Example 2: Real-time Toy Identification Using Images

Objective: Train a classifier to identify toy

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 CAR, HELICOPTER, PLANE, BIKE

(Classification)

Page 15: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

15

PREDICTIONMODEL

Machine Learning Workflow for Example

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 16: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

16

Machine Learning

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

– Common challenges in Machine Learning

Example: Human activity learning using mobile phone data

Example: Real-time object identification using images

Example: Load forecasting using weather data

Summary & Key Takeaways

Agenda

Page 17: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

17

Example 3: Day-Ahead System Load Forecasting

Objective: Train a neural network to predict

the required system load for a zone

Data:

Approach:

– Extract additional features

– Train neural network

– Predict load

Predictors Temperature, Dew point, Month,

Day of week, Prior day load, Prior

week load

Response LOAD

(Regression)

Page 18: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

18

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

Temp, Dew point

Day of week

Prior day load

Prior week load

Neural Network

Temp, Dew point

Day of week

Prior day load

Prior week load

Page 19: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

19

Machine Learning

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

– Common challenges in Machine Learning

Example: Human activity learning using mobile phone data

Example: Real-time object identification using images

Example: Load forecasting using weather data

Summary & Key Takeaways

Agenda

Page 20: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

20

Steps Challenge

Accessing, exploring and

analyzing dataData diversity

Preprocess data Lack of domain tools

Train models Time consuming

Assess model

performance

Avoid pitfallsOver Fitting,

Speed-Accuracy-Complexity

Iterate

Challenges in Machine Learning

Page 21: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

21

MATLAB Strengths for Machine Learning

Challenge Solution

Data diversityExtensive data support

Import and work with signal, images, financial,

Textual, geospatial, and several others formats

Lack of domain toolsHigh-quality libraries

Industry-standard algorithms for Finance, Statistics, Signal,

Image processing & more

Time consuming Interactive, app-driven workflows

Focus on machine learning, not programing

Avoid pitfallsOver Fitting,

Speed-Accuracy-Complexity

Integrated best practicesModel validation tools built into app

Rich documentation with step by step guidance

Flexible architecture for customized workflowsComplete machine learning platform

Page 22: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

22

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

Key Takeaways

Page 23: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

23

Additional Resources

Documentation:Machine Learning with MATLAB:

Page 24: Machine Learning for Predictive Modelling...Machine Learning Machine learning uses data and produces a model to perform a task Standard Approach Machine Learning Approach = < 𝒂𝒄

24

Q & A

Topic of interest Session / Demo Station

Working with IoT data Session: MATLAB and the Internet of Things (IoT): Collecting and

Analysing IoT Data

Accessing, analysing and

visualising data

Session: Analysis of Experimental and Test Data

Working with big data sets Session: Tackling Big Data with MATLAB

Deploying machine learning

algorithms

Demo: Building MATLAB Apps to Visualise Complex Data

Machine learning with computer

vision

Demo: Identification of Objects in Real-Time Video