d Tw Algorithm
-
Upload
mohamed-ismail-majeed-m -
Category
Documents
-
view
221 -
download
0
Transcript of d Tw Algorithm
-
8/18/2019 d Tw Algorithm
1/15
-
8/18/2019 d Tw Algorithm
2/15
Gene expression time series are expected to vary not
only in terms of expression amplitudes, but also in terms
of time progression since biological processes may unfold
with different rates in response to different experimental
conditions or within different organisms and individuals.
What is Special about Time Series Data?
time
-
8/18/2019 d Tw Algorithm
3/15
i
i+2
i
i i
timetime
Why Dynamic Time Warping?
Any distance (Euclidean, Manhattan,
… !hich aligns the i"th point on onetime series !ith the i"th point on the
other !ill produce a poor similarity
score#
A non"linear (elastic alignment
produces a more intuiti$e similaritymeasure, allo!ing similar shapes to
match e$en i% they are out o% phase in
the time a&is#
-
8/18/2019 d Tw Algorithm
4/15
j s
i s
m
'
n'
me Series B
Time Series A
Warping unction
pk
ps
p1
To find the best alignment
between A and B one needs
to find the path through the
grid
P = p1, … , ps , … , pk
ps ) (i s , j s
which minimizes the total
distance between them.
P is called a warping function.
-
8/18/2019 d Tw Algorithm
5/15
Time"*ormali+ed Distance Measure
D( A , B )
⋅
∑
∑
=
=
k
s
s
k
s
s s
w
w pd
'
'
(
d ( p s: distance between i s and j s
P
minarg
w s -: weighting coefficient.
Best alignment path between A
and B :
Time-normalized distance between
A and B :
P 0 ) ( D( A ,
B #
j s
i s
m
'
n'
me Series B
Time Series A
pk
ps
p1
-
8/18/2019 d Tw Algorithm
6/15
.ptimisations to the DTW Algorithm
The number of possible warping
paths through the grid is
exponentially explosive!
Restrictions on the warping function:
• monotonicity
• continuity• boundary conditions
• warping window
• slope constraint.
reduction of thesearch space
j s
i s
m
'
n'
me Series B
Time Series A
-
8/18/2019 d Tw Algorithm
7/15
/estrictions on the Warping unction
Monotonicity : i s-1 0 i s and j s-1 0 j s.
The alignment path does not go bac
in time" index.
Continuity : i s 1 i s-1 0 ' and j s 1 j s-1 0 '.
The alignment path does not #ump in
time" index.
Guarantees that features are not
repeated in the alignment.
Guarantees that the alignment does
not omit important features.
i
j
i
j
-
8/18/2019 d Tw Algorithm
8/15
/estrictions on the Warping unction
Boundary Conditions: i 1 ) ', i k ) n and j 1 ) ', j k ) m.
The alignment path starts at the bottom
left and ends at the top right.
Warping Window : i s 1 j s 0 r , where r - is the window length.
$ good alignment path is unliely to
wander too far from the diagonal.
Guarantees that the alignment does not
consider partially one of the se%uences.
Guarantees that the alignment does not
try to sip different features and gets
stuc at similar features.
n
m
i
j
(',' i
j
r
-
8/18/2019 d Tw Algorithm
9/15
/estrictions on the Warping unction
Slope Constraint : ( j s p 1 j s- / ( i s p 1 i s- 0 p and ( i sq 1 i s- / ( j sq 1 j s- 0 q , where q 3 -
is the number of steps in the x &direction and p 3 - is the number of steps in the y&
direction. $fter q steps in x one must step in y and vice versa: S ) p / q ∈4- , ∝5#
'revents that very short parts of the se%uences
are matched to very long ones.
The alignment path should not be too steep or
too shallow.
i
j ≤ p ≤ q
-
8/18/2019 d Tw Algorithm
10/15
The 6hoice o% the Weighting 6oe%%icient
D( A , B ) #
(
min
'
'
⋅
∑
∑
=
=k
s
s
k
s
s s
P
w
w pd
Time&normali(ed distance between A and B :
complicates
optimisation
⋅∑
=
k
s
s s P
w pd C '
(min'
D( A , B )
∑=
=k
s
swC
'
)eeing a weighting coefficient function which
guarantees that:
can be solved by use of dynamic programming.
is independent of the warping function. Thus
*eighting +oefficient efinitions
• Symmetric form
w s ) (i s 1 i s"' 7 ( j s 1 j s-',
then C = n 7 m.
• Asymmetric form
w s ) (i s 1 i s-',
then C = n#
-r e%uivalently,
w s ) ( j s 1 j s-',
then C = m#
-
8/18/2019 d Tw Algorithm
11/15
nitial condition: g(',' ) 2d(','#
'&e%uation:
g(i , j 1 ' 7 d(i , j
g(i , j ) min g(i 1 ', j 1 ' 7 2d(i , j #
g(i 1 ', j 7 d(i , j
*arping window: j 1 r 0 i 0 j 7 r #
Time&normali(ed distance:
D( A , B ) g(n, m 8 C
C = n 7 m.
Symmetric DTW Algorithm
(!arping !indo!, no slope constraint
j
m
'
n' i
g(','
g(n, m
i ) j 7 r
i ) j " r
''
2
me Series B
Time Series A
-
8/18/2019 d Tw Algorithm
12/15
-
8/18/2019 d Tw Algorithm
13/15
nitial condition: g(',' ) d(','#
'&e%uation:
g(i , j 1 ' 7 d(i , j
g(i , j ) min g(i 1 ', j 1 ' 7 d(i , j #
g(i 1 ', j 7 d(i , j
*arping window: j 1 r 0 i 0 j 7 r #
Time&normali(ed distance:
D( A , B ) g(n, m 8 C
C = n 7 m.
9ua+i"symmetric DTW Algorithm
(!arping !indo!, no slope constraint
j
m
'
n' i
g(','
g(n, m
i ) j 7 r
i ) j " r
''
'
me Series B
Time Series A
-
8/18/2019 d Tw Algorithm
14/15
-
8/18/2019 d Tw Algorithm
15/15
DTW Algorithm< E&le
0!"# 0!"$ 0!"% 0!"& 0!&' 1!(% 1!') 0!)0 0!0 0!&(
0!"" 0!(1 0!"$ 0!"& 0!&$ 1!(& 1!$1 0!%1 0!0' 0!1"
0 !
) 0
0 !
) %
0 !
# 1
0 !
% "
0 !
1 #
0 ! #
#
1 !
( $
0 !
$ )
0 !
) &
0 !
) "
0 !
) '
0 !
' &
0 ! #
$
1 !
( #
0!0& -#-= -#-> -#'' -#' -#@ -#@ -#=> -#B -#BB
-#-@ 0!0$ -#-B -#-> -#'' -#2 -#@ -#= -#B@ -#BB
-#-B -#-B 0!0) -#-C -#'' -#2 -#=- -#B- -#B= -#B>
-#-> -#-> -#-> 0!0" -#'- -#' -#@C -#=C -#B2 -#B=
-#' -#' -#' -#'2 0!0" -#2B -#@- -#@C -#@ -#@
-#2C -#2C -#2B -#2= -#'B 0!1" 0!&' 0!&% 0!'1 -#B>
-#=' -#=' -#@ -#@ -#= -#'C -#2' -# -#@' 0!$(
Time Series B
Time Series A
Euclidean distance bet!een $ectors