Outline Specificities of SEQUENTIAL data Alignment of sequences by - - PDF document

outline
SMART_READER_LITE
LIVE PREVIEW

Outline Specificities of SEQUENTIAL data Alignment of sequences by - - PDF document

Machine-Learning for SEQUENTIAL data Pr. Fabien Moutarde Center for Robotics MINES ParisTech PSL Universit Paris Fabien.Moutarde@mines-paristech.fr http://people.mines-paristech.fr/fabien.moutarde Machine-Learning for SEQUENTIAL data, Pr.


slide-1
SLIDE 1

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 1

Machine-Learning for SEQUENTIAL data

  • Pr. Fabien Moutarde

Center for Robotics MINES ParisTech PSL Université Paris

Fabien.Moutarde@mines-paristech.fr http://people.mines-paristech.fr/fabien.moutarde

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 2

Outline

  • Specificities of SEQUENTIAL data
  • Alignment of sequences by DTW
  • Model sequential data with HMM
slide-2
SLIDE 2

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 3

Specificities of SEQUENTIAL data

  • 2 specific problems:

– How to compare sequences? – Length often VARIABLE!

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 4

Handling COMPARISON

  • f sequences
  • 2 main types of approaches:

– Alignment of sequences à Dynamic Time Warping (DTW) – Model-based method (e.g. Hidden Markov Model, HMM)

slide-3
SLIDE 3

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 5

Handling VARIABLE LENGTH

  • f sequences
  • 2 main types of approaches:

– Time Resampling (but unapplicable for “stream” inline recognition) – Model-based methods: streaming successive inputs into a fixed-size model

  • Hidden Markov Model (HMM)
  • Recurrent Neural Network (RNN)

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 6

Outline

  • Specificities of SEQUENTIAL data
  • Alignment of sequence by DTW
  • Model sequential data with HMM
slide-4
SLIDE 4

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 7

Dynamic Time Warping

  • Principle of DTW:
  • 1. Align sequences and compute an adapted

similarity measure

  • 2. Perform recognition by template-matching

with k Nearest Neighbors (using DTW similarity)

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 8

Alignment of sequences

[Slide from Elena Tsiporkova]

slide-5
SLIDE 5

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 9

[Slide from Elena Tsiporkova]

Warping function

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 10

Time-Normalized Distance Measure

[Slide from Elena Tsiporkova]

slide-6
SLIDE 6

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 11

[Slide from Elena Tsiporkova]

Optimizing DTW algorithm

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 12

Usual restrictions

  • n Warping function

[Slide from Elena Tsiporkova]

slide-7
SLIDE 7

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 13

[Slide from Elena Tsiporkova]

Other restrictions

  • n Warping function

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 14

Slope constraints

  • n Warping function

[Slide from Elena Tsiporkova]

slide-8
SLIDE 8

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 15

[Slide from Elena Tsiporkova]

Choice of weighting coefficients

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 16

Pros and Cons of DTW

  • Pros

– Allows speed-insensitive and flexible alignment

  • Cons

– Computationally expansive (especially for multi-variate time-series) – Vanilla version is OFFLINE (i.e. after gesture) BUT “STREAM DTW” version solves this issue

slide-9
SLIDE 9

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 17

Outline

  • Specificities of SEQUENTIAL data
  • Alignment of sequence by DTW
  • Model sequential data with HMM

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 18

Stochastic (probabilistic) model

  • btained by statistical analysis of

sequences of many examples of same class

What is a HMM?

slide-10
SLIDE 10

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 19

« The future is independent of the past, given the present »

Andreï Andreïevitch Markov Андрей Андреевич Марков 2 June 1856 - 20 July 1921

Markovian??

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 20

  • Set of N States, {S1, S2,… SN}
  • Sequence of states Q ={q1, q2,…}
  • Initial probabilities π={π1, π2,… πN}

– πi=P(q1=Si)

  • Transition matrix A NxN
  • aij=P(qt+1=Sj | qt=Si)

Markov chains

slide-11
SLIDE 11

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 21

Weather model:

  • 3 states {sunny, rainy,

cloudy}

S

1

S

1

S

2

S

1

S

2

Problem:

  • Forecast weather state, based
  • n the current weather state

Example of Markov chain

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 22

Let’s pick arbitrarily some numbers for ! | "# "#$% and draw a probabilistic finite state automaton 0,2 0,4 2 S1 S2 S3 S5 S4 0,4 0,4 0,4 0,4 0,4 0,4 0,4 0,4 0,4 0,2 0,2 0,2 0,2 Question Given that now the state is S2, what’s the probability that next state will be S3 AND the state after will be S4?

Markov chain in action

slide-12
SLIDE 12

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 23

Answer to Question This translates into: You can also think this as moving through the automaton, multiplying the probabilities S2 S3 S4 = ! "& = | '( ") = '&, "% = ') * ! ") = | '& "% = ') = ! "& = | '( ") = '& * ! ") = | '& "% = ') = 0,4 * 0,4 = 0,16 ! ") = '&, "& = '(+"% = ')

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 24

λ=(A, B, π): Hidden Markov Model

  • A={aij}: Transition probabilities between HIDDEN states

– aij=P(qt+1=Sj | qt=Si)

  • Β={bi(x)}: Emission probabilities for observation given hidden

state – bi(Οt)=P(Οt=x | qt=Si)

  • π={πi}: Initial state probabilistic distribution

– πi=P(q1=Si)

slide-13
SLIDE 13

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 25

S

1

S

2

S

3

S

4

S

1

S

2

S

3

S

4

S

1

S

2

S

3

S

1

S

2

S

4

S

6

S

3

S

5

Left to right (A) Left to right (B) Left to right (C) Ergodic

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 26

  • Evaluation

– O, λ → P(O|λ)

  • Uncover the hidden part

– O, λ → Q that P(Q|O, λ) is maximum

  • Learning

– {Ο} → λ such that P(O|λ) is maximum

slide-14
SLIDE 14

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 27

O, λ → P(O|λ) ?

  • Solved by the Forward algorithm

Applications – Find some likely samples – Evaluation of a sequence of

  • bservations

– Change detection

S

1

S

2

S

4

S

6

S

3

S

5

x x x x x x

a 11 a 22 a 33 a 44 a 55 a 66 a 12 a 23 a 34 a 45 a 56 b1(x) b2(x) b3(x) b4(x) b5(x) b6(x) a a 23

conditionally independent

Initialisation Induction Termination

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 29

  • {Ο} → λ such that P(O|λ) is maximum
  • No analytic solution
  • Solved by Baum-Welch algorithm

(which is particular case of Expectation Maximization [EM] algo) when some data is missing (the states)

  • Applications

– Unsupervised Learning (single HMM) – Supervised Learning (multiple HMM) η θ g

max

slide-15
SLIDE 15

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 30

Sequence of

  • bservations

Μ1 Μ2 Μ4

…. ….

Gesture recognition Likelihood computation Maximum likelihood computation

….

Likelihood computation Likelihood computation

O(t)1:7

  • Typically, learn ONE HMM per class, and then sequentially

feed data in all HMM, so each one updates likelihood of sequence

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 31

slide-16
SLIDE 16

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 32

Pros and Cons of HMM

  • Pros

– Natural handling of variable length

  • Cons

– Many hyper-parameters (ARCHITECTURE and # of hidden states)

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 33

Synthesis

  • Sequential data raise specific problems:

– what similarity measure should be used? (cf alignment problem) – Often variable length input

  • Two main shallow ML approaches adapted to this

specificities: – Dynamic Time Warping (DTW) – Hidden Markov Model (HMM)

Deep-Learning à Deep RECURRENT Neural Nets (LSTM, GRU)

  • r 1D ConvNet over time
slide-17
SLIDE 17

Machine-Learning for SEQUENTIAL data, Pr. Fabien Moutarde, Center for Robotics, MINES ParisTech, PSL, June 2020 34

Any QUESTIONS ?