SlideShare a Scribd company logo
7
Most read
16
Most read
18
Most read
Time Series Predictions
using Long Short-Term
Memory
Setu Chokshi
IoT Asia 2017 – 30th March
LSTMs are mainstream
What are Neural Network
Y1
Y2
X1
X2
X3
h1
h2
h3
h4
Information Transfer
Input Values
Calculator – Activations
Output (Activation)
1
2
3
4
Input Hidden Output
X1
X2
X3
W11
W21
W31
 
h1
Example of  = REctified Linear Unit =
max(0,input)
Strengthen weak signals; Leave strong
signals alone
Weight is the strength of the connection
between nodes
1
Challenges
 Only fixed sized inputs & outputs
 Performs mapping of features from input to output
 No memory and hence difficult to model time series
Lets add some memory
Input Hidden Output
Input + prevInput Hidden Output Input+ prevHidden Hidden Output
Input + prevInput Hidden Output
Input + prevInput Hidden Output
Input + prevInput Hidden Output
Input + prevInput Hidden Output
Input + prevHidden Hidden Output
Input + prevHidden Hidden Output
Input + prevHidden Hidden Output
Input + prevHidden Hidden Output
Approach 1: Add previous inputs Approach 2: Add previous hidden
Lets do 4 time series steps Lets do 4 time series steps
Lets add some memory…and color
Input Hidden Output
Input + prevInput Hidden Output Input+ prevHidden Hidden Output
Input + prevInput Hidden Output
Input + prevInput Hidden Output
Input + prevInput Hidden Output
Input + prevInput Hidden Output
Input + prevHidden Hidden Output
Input + prevHidden Hidden Output
Input + prevHidden Hidden Output
Input + prevHidden Hidden Output
Approach 1: Add previous inputs Approach 2: Add previous hidden
Lets do 4 time series steps Lets do 4 time series steps
Lets build an LSTM
Xt
   
0 1 2 3
ht-1
Ct-1 Ct✖
✖

✖σ σ σtanh
tanh
ht
ht
Ct-1
Now lets build an LSTM
Element-
wise
Summation
/
Concatenati
on
Element-
wise
multiplicatio
n
X
t
ht-
1
Ct-
1
h
t
C
t
0
σ

✖
tanh
Inputs: Outputs:
Input vector
Memory
from
previous
blockOutput of
previous
block
Memory
from
current
blockOutput of
current
block
Nonlinearities:
Sigmoid
Hyperbolic
tangent
Vector
operations:
Bias:
Lets skip the math, ok?
Element-
wise
summation
Element-
wise
multiplicatio
n
✖ = =
Memory Pipeline
Xt
   
0 1 2 3
ht-1
Ct-1
C
t
ht
✖
✖

✖σ σ σtanh
tanh
ht
✖
Forget Layer
Xt
   
0 1 2 3
ht-1
Ct-1 Ct
ht
✖
✖

✖σ σ σtanh
tanh
ht
Generate new memories: Input
Xt
  + 
0 1 2 3
ht-1
Ct-1 Ct
ht
✖
✖

✖σ σ σtanh
tanh
ht

2
tanh
Generate new memories: Candidate
Xt
   
0 1 2 3
ht-1
Ct-1 Ct
ht
✖
✖

✖σ σ σtanh
tanh
ht
Memory Pipeline
Xt
   
0 1 2 3
ht-1
Ct-1 Ct
ht
✖
✖

✖σ σ σtanh
tanh
ht
Generate the output
Xt
   
0 1 2 3
ht-1
Ct-1 Ct
ht
✖
✖

✖σ σ σtanh
tanh
ht
EXAMPLES
Sin wave predictor
 Generate sin curve
 Load 5000 X 50
sequences
 90:10 split on train/test
sets
Power Consumption Dataset
 Power Consumption
Dataset
 47 Months of data
 2075259 measurements
 Active energy consumed
per min
 Load 4567 X 50
sequences
 90:10 split on train/test
sets
References
 Understanding LSTM Networks
http://colah.github.io/posts/2015-08-Understanding-
LSTMs/
 General Sequence Learning using Recurrent
Neural Networks
https://www.youtube.com/watch?v=VINCQghQRuM
 Recurrent Neural Networks Part 1: Theory
https://www.slideshare.net/gakhov
 Facebook Prophet
https://github.com/facebookincubator/prophet
 Images adapted from Shi Yan
https://medium.com/@shiyan/understanding-lstm-and-its-
diagrams-37e2f46f1714
 Anyone Can Learn To Code
https://iamtrask.github.io/2015/11/15/anyone-can-code-lstm/
THANK YOU
@setuc
www.linkedin.com/in/setuchoks
hi/
github.com/setuc/iotAsia2017

More Related Content

PPTX
PPTX
Time Series Analysis.pptx
PPT
Chapter 14_The International Financial System
PDF
PDF
Time series forecasting with ARIMA
PPTX
PPT
Decision tree and random forest
PDF
Total Quality Management - ( TQM )
Time Series Analysis.pptx
Chapter 14_The International Financial System
Time series forecasting with ARIMA
Decision tree and random forest
Total Quality Management - ( TQM )

What's hot (20)

PPTX
Word embeddings, RNN, GRU and LSTM
PDF
LSTM Tutorial
PDF
Recurrent Neural Networks, LSTM and GRU
PDF
Rnn and lstm
PDF
Recurrent neural networks rnn
PDF
Recurrent Neural Networks. Part 1: Theory
PPT
rnn BASICS
PPTX
Dbscan algorithom
PPTX
RNN-LSTM.pptx
PDF
Recurrent Neural Networks
PPTX
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
PPTX
Stochastic Gradient Decent (SGD).pptx
PPTX
Backpropagation And Gradient Descent In Neural Networks | Neural Network Tuto...
PDF
LSTM Basics
PPTX
Understanding RNN and LSTM
PDF
Deep Feed Forward Neural Networks and Regularization
PPTX
Long Short Term Memory (Neural Networks)
PDF
Recurrent Neural Networks (RNN) | RNN LSTM | Deep Learning Tutorial | Tensorf...
PDF
Deep Learning - Convolutional Neural Networks
PPTX
Recurrent Neural Network
Word embeddings, RNN, GRU and LSTM
LSTM Tutorial
Recurrent Neural Networks, LSTM and GRU
Rnn and lstm
Recurrent neural networks rnn
Recurrent Neural Networks. Part 1: Theory
rnn BASICS
Dbscan algorithom
RNN-LSTM.pptx
Recurrent Neural Networks
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
Stochastic Gradient Decent (SGD).pptx
Backpropagation And Gradient Descent In Neural Networks | Neural Network Tuto...
LSTM Basics
Understanding RNN and LSTM
Deep Feed Forward Neural Networks and Regularization
Long Short Term Memory (Neural Networks)
Recurrent Neural Networks (RNN) | RNN LSTM | Deep Learning Tutorial | Tensorf...
Deep Learning - Convolutional Neural Networks
Recurrent Neural Network
Ad

Viewers also liked (17)

PPTX
Machine Learning 101
PDF
How to Become a Thought Leader in Your Niche
PPTX
Project Management Trends 2017
PDF
DATA, CREATIVITY & INSIGHT - Killing the misconception that data is the enemy...
PPTX
Implementing a Fileserver with Nginx and Lua
PPTX
Product Management 101
PDF
Data and Creativity - A Content Marketing Winning Formula - SASCon 2016
PDF
Technology, creativity & data: How to tell your story, engage your audience a...
PDF
Startup/Digital Marketing 2.0: Growth Hacking Thru UX
PDF
Best Practice For UX Deliverables - Eventhandler, London, 05 March 2014
PDF
SCK :: Scrum is NOT Enough
PDF
UX Design + UI Design: Injecting a brand persona!
PDF
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
PDF
Product Manager 101: What Does A Product Manager Actually Do?
PDF
SXSW 2016: The Need To Knows
PDF
[Infographic] How will Internet of Things (IoT) change the world as we know it?
PDF
Mobile-First SEO - The Marketers Edition #3XEDigital
Machine Learning 101
How to Become a Thought Leader in Your Niche
Project Management Trends 2017
DATA, CREATIVITY & INSIGHT - Killing the misconception that data is the enemy...
Implementing a Fileserver with Nginx and Lua
Product Management 101
Data and Creativity - A Content Marketing Winning Formula - SASCon 2016
Technology, creativity & data: How to tell your story, engage your audience a...
Startup/Digital Marketing 2.0: Growth Hacking Thru UX
Best Practice For UX Deliverables - Eventhandler, London, 05 March 2014
SCK :: Scrum is NOT Enough
UX Design + UI Design: Injecting a brand persona!
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Product Manager 101: What Does A Product Manager Actually Do?
SXSW 2016: The Need To Knows
[Infographic] How will Internet of Things (IoT) change the world as we know it?
Mobile-First SEO - The Marketers Edition #3XEDigital
Ad

Similar to Time series predictions using LSTMs (20)

PPTX
streamingalgo88585858585858585pppppp.pptx
PDF
Hardware Acceleration for Machine Learning
PDF
RNNs for Timeseries Analysis
PDF
Options and trade offs for parallelism and concurrency in Modern C++
PPTX
Deep learning from scratch
PDF
C–Analysis and Design Procedures–Binary Adder-Subtractor
PPT
cipherrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.ppt
PDF
Tiling matrix-matrix multiply, code tuning
PDF
Simple, fast, and scalable torch7 tutorial
PPT
Convex Optimization Modelling with CVXOPT
PPTX
On Mining Bitcoins - Fundamentals & Outlooks
PDF
nand2tetris 舊版投影片 -- 第二章 布林算術
PPTX
8_dynamic_algorithm powerpoint ptesentation.pptx
PDF
Enabling Power-Efficient AI Through Quantization
PPTX
Fundamentals of Neural Networks_AhmadMasri_26_06_2024.pptx
PDF
Cryptography 202
PPTX
Introduction to Neural Networks and Deep Learning
PPTX
lec20111111111111111111111111111111111111.pptx
PPTX
Digit recognizer by convolutional neural network
PDF
Probabilistic data structures. Part 3. Frequency
streamingalgo88585858585858585pppppp.pptx
Hardware Acceleration for Machine Learning
RNNs for Timeseries Analysis
Options and trade offs for parallelism and concurrency in Modern C++
Deep learning from scratch
C–Analysis and Design Procedures–Binary Adder-Subtractor
cipherrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.ppt
Tiling matrix-matrix multiply, code tuning
Simple, fast, and scalable torch7 tutorial
Convex Optimization Modelling with CVXOPT
On Mining Bitcoins - Fundamentals & Outlooks
nand2tetris 舊版投影片 -- 第二章 布林算術
8_dynamic_algorithm powerpoint ptesentation.pptx
Enabling Power-Efficient AI Through Quantization
Fundamentals of Neural Networks_AhmadMasri_26_06_2024.pptx
Cryptography 202
Introduction to Neural Networks and Deep Learning
lec20111111111111111111111111111111111111.pptx
Digit recognizer by convolutional neural network
Probabilistic data structures. Part 3. Frequency

More from Setu Chokshi (8)

PPTX
Build vs Buy: Ensuring maximum ROI from AI
PPTX
AI for AI: Building state of the art models
PPTX
Microsoft Introduction to Automated Machine Learning
PPTX
2018 Global Azure Bootcamp Azure Machine Learning for neural networks
PPTX
Azure machine learning 101 Parts 1 & 2 - Classification Algorithms
PPTX
Azure machine learning 101 - Part 1
PPTX
Analysis on the US Consumer Expenditure
PPTX
Azure Boot Camp 2017 getting started with azure machine learning
Build vs Buy: Ensuring maximum ROI from AI
AI for AI: Building state of the art models
Microsoft Introduction to Automated Machine Learning
2018 Global Azure Bootcamp Azure Machine Learning for neural networks
Azure machine learning 101 Parts 1 & 2 - Classification Algorithms
Azure machine learning 101 - Part 1
Analysis on the US Consumer Expenditure
Azure Boot Camp 2017 getting started with azure machine learning

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
KodekX | Application Modernization Development
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KodekX | Application Modernization Development
Empathic Computing: Creating Shared Understanding
NewMind AI Weekly Chronicles - August'25 Week I
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf

Time series predictions using LSTMs

  • 1. Time Series Predictions using Long Short-Term Memory Setu Chokshi IoT Asia 2017 – 30th March
  • 3. What are Neural Network Y1 Y2 X1 X2 X3 h1 h2 h3 h4 Information Transfer Input Values Calculator – Activations Output (Activation) 1 2 3 4 Input Hidden Output X1 X2 X3 W11 W21 W31   h1 Example of  = REctified Linear Unit = max(0,input) Strengthen weak signals; Leave strong signals alone Weight is the strength of the connection between nodes 1
  • 4. Challenges  Only fixed sized inputs & outputs  Performs mapping of features from input to output  No memory and hence difficult to model time series
  • 5. Lets add some memory Input Hidden Output Input + prevInput Hidden Output Input+ prevHidden Hidden Output Input + prevInput Hidden Output Input + prevInput Hidden Output Input + prevInput Hidden Output Input + prevInput Hidden Output Input + prevHidden Hidden Output Input + prevHidden Hidden Output Input + prevHidden Hidden Output Input + prevHidden Hidden Output Approach 1: Add previous inputs Approach 2: Add previous hidden Lets do 4 time series steps Lets do 4 time series steps
  • 6. Lets add some memory…and color Input Hidden Output Input + prevInput Hidden Output Input+ prevHidden Hidden Output Input + prevInput Hidden Output Input + prevInput Hidden Output Input + prevInput Hidden Output Input + prevInput Hidden Output Input + prevHidden Hidden Output Input + prevHidden Hidden Output Input + prevHidden Hidden Output Input + prevHidden Hidden Output Approach 1: Add previous inputs Approach 2: Add previous hidden Lets do 4 time series steps Lets do 4 time series steps
  • 7. Lets build an LSTM Xt     0 1 2 3 ht-1 Ct-1 Ct✖ ✖  ✖σ σ σtanh tanh ht ht Ct-1
  • 8. Now lets build an LSTM Element- wise Summation / Concatenati on Element- wise multiplicatio n X t ht- 1 Ct- 1 h t C t 0 σ  ✖ tanh Inputs: Outputs: Input vector Memory from previous blockOutput of previous block Memory from current blockOutput of current block Nonlinearities: Sigmoid Hyperbolic tangent Vector operations: Bias:
  • 9. Lets skip the math, ok? Element- wise summation Element- wise multiplicatio n ✖ = =
  • 10. Memory Pipeline Xt     0 1 2 3 ht-1 Ct-1 C t ht ✖ ✖  ✖σ σ σtanh tanh ht ✖
  • 11. Forget Layer Xt     0 1 2 3 ht-1 Ct-1 Ct ht ✖ ✖  ✖σ σ σtanh tanh ht
  • 12. Generate new memories: Input Xt   +  0 1 2 3 ht-1 Ct-1 Ct ht ✖ ✖  ✖σ σ σtanh tanh ht  2 tanh
  • 13. Generate new memories: Candidate Xt     0 1 2 3 ht-1 Ct-1 Ct ht ✖ ✖  ✖σ σ σtanh tanh ht
  • 14. Memory Pipeline Xt     0 1 2 3 ht-1 Ct-1 Ct ht ✖ ✖  ✖σ σ σtanh tanh ht
  • 15. Generate the output Xt     0 1 2 3 ht-1 Ct-1 Ct ht ✖ ✖  ✖σ σ σtanh tanh ht
  • 17. Sin wave predictor  Generate sin curve  Load 5000 X 50 sequences  90:10 split on train/test sets
  • 18. Power Consumption Dataset  Power Consumption Dataset  47 Months of data  2075259 measurements  Active energy consumed per min  Load 4567 X 50 sequences  90:10 split on train/test sets
  • 19. References  Understanding LSTM Networks http://colah.github.io/posts/2015-08-Understanding- LSTMs/  General Sequence Learning using Recurrent Neural Networks https://www.youtube.com/watch?v=VINCQghQRuM  Recurrent Neural Networks Part 1: Theory https://www.slideshare.net/gakhov  Facebook Prophet https://github.com/facebookincubator/prophet  Images adapted from Shi Yan https://medium.com/@shiyan/understanding-lstm-and-its- diagrams-37e2f46f1714  Anyone Can Learn To Code https://iamtrask.github.io/2015/11/15/anyone-can-code-lstm/

Editor's Notes

  • #4: Unlike all hidden layers in a neural network, the output layer units most commonly have as activation function: 1. Linear identity function (for regression problems) 2. Softmax (for classification problems).
  • #11: If you multiply the old memory C_t-1 with a vector that is close to 0, that means you want to forget most of the old memory. You let the old memory goes through, if your forget valve equals 1. Then the second operation the memory flow will go through is this + operator. New memory and the old memory will merge by this operation. How much new memory should be added to the old memory is controlled by another valve, the ✖ below the + sign.
  • #12: Sometimes it’s good to forget. If you’re analyzing a text corpus and come to the end of a document you may have no reason to believe that the next document has any relationship to it whatsoever, and therefore the memory cell should be reset before the network gets the first element of the next document. In many cases by reset we don’t only mean immediate set it to 0, but also gradual resets corresponding to slowly fading cell states