1mlib_SignalDTWVectorPath_F3m2e(d3iMaLLIiBb)Library Fmulnicbt_iSoingsnalDTWVectorPath_F32(3MLIB)
2
3
4
6 mlib_SignalDTWVectorPath_F32 - perform dynamic time warping on vector
7 data
8
10 cc [ flag... ] file... -lmlib [ library... ]
11 #include <mlib.h>
12
13 mlib_status mlib_SignalDTWVectorPath_F32(mlib_d64 *dist, mlib_s32 *path,
14 mlib_s32 *lpath, const mlib_f32 **dobs, mlib_s32 lobs, void *state);
15
16
18 The mlib_SignalDTWVectorPath_F32() function performs dynamic time warp‐
19 ing on vector data.
20
21
22 Assume the reference data are
23
24 r(y), y=1,2,...,N
25
26
27
28 and the observed data are
29
30 o(x), x=1,2,...,M
31
32
33
34 the dynamic time warping is to find a mapping function (a path)
35
36 p(i) = {px(i),py(i)}, i=1,2,...,Q
37
38
39
40 with the minimum distance.
41
42
43 In K-best paths case, K paths with the K minimum distances are
44 searched.
45
46
47 The distance of a path is defined as
48
49 Q
50 dist = SUM d(r(py(i)),o(px(i))) * m(px(i),py(i))
51 i=1
52
53
54
55 where d(r,o) is the dissimilarity between data point/vector r and data
56 point/vector o; m(x,y) is the path weighting coefficient associated
57 with path point (x,y); N is the length of the reference data; M is the
58 length of the observed data; Q is the length of the path.
59
60
61 Using L1 norm (sum of absolute differences)
62
63 L-1
64 d(r,o) = SUM |r(i) - o(i)|
65 i=0
66
67
68
69 Using L2 norm (Euclidean distance)
70
71 L-1
72 d(r,o) = SQRT { SUM (r(i) - o(i))**2 }
73 i=0
74
75
76
77 where L is the length of each data vector.
78
79
80 To scalar data where L=1, the two norms are the same.
81
82 d(r,o) = |r - o| = SQRT {(r - o)**2 }
83
84
85
86 The constraints of dynamic time warping are:
87
88 1. Endpoint constraints
89
90 px(1) = 1
91 1 ≤ py(1) ≤ 1 + delta
92
93 and
94
95 px(Q) = M
96 N-delta ≤ py(Q) ≤ N
97
98
99 2. Monotonicity Conditions
100
101 px(i) ≤ px(i+1)
102 py(i) ≤ py(i+1)
103
104
105 3. Local Continuity Constraints
106
107 See Table 4.5 on page 211 in Rabiner and Juang's book.
108
109 Itakura Type:
110
111 py
112 |
113 *----*----*
114 |p4 |p1 |p0
115 | | |
116 *----*----*
117 | |p2 |
118 | | |
119 *----*----*-- px
120 p3
121
122 Allowable paths are
123
124 p1->p0 (1,0)
125 p2->p0 (1,1)
126 p3->p0 (1,2)
127
128 Consecutive (1,0)(1,0) is disallowed. So path p4->p1->p0 is
129 disallowed.
130
131 4. Global Path Constraints
132
133 Due to local continuity constraints, certain portions of the
134 (px,py) plane are excluded from the region the optimal warp‐
135 ing path can traverse. This forms global path constraints.
136
137 5. Slope Weighting
138
139 See Equation 4.150-3 on page 216 in Rabiner and Juang's
140 book.
141
142
143 A path in (px,py) plane can be represented in chain code. The value of
144 the chain code is defined as following.
145
146 ============================
147 shift ( x , y ) | chain code
148 ----------------------------
149 ( 1 , 0 ) | 0
150 ( 0 , 1 ) | 1
151 ( 1 , 1 ) | 2
152 ( 2 , 1 ) | 3
153 ( 1 , 2 ) | 4
154 ( 3 , 1 ) | 5
155 ( 3 , 2 ) | 6
156 ( 1 , 3 ) | 7
157 ( 2 , 3 ) | 8
158 ============================
159
160 py
161 |
162 * 8 7 *
163 |
164 * 4 * 6
165 |
166 1 2 3 5
167 |
168 x--0--*--*-- px
169
170
171
172 where x marks the start point of a path segment, the numbers are the
173 values of the chain code for the segment that ends at the point.
174
175
176 In following example, the observed data with 11 data points are mapped
177 into the reference data with 9 data points
178
179 py
180 |
181 9 | * * * * * * * * * *-*
182 | /
183 | * * * * * * * *-* * *
184 | /
185 | * * * * * * * * * * *
186 | /
187 | * * * * *-* * * * * *
188 | /
189 | * * * * * * * * * * *
190 | |
191 | * * * * * * * * * * *
192 | /
193 | * * * * * * * * * * *
194 | /
195 | * * * * * * * * * * *
196 | /
197 1 | * * * * * * * * * * *
198 |
199 +------------------------ px
200 1 11
201
202
203
204 The chain code that represents the path is
205
206 (2 2 2 1 2 0 2 2 0 2 0)
207
208
209
210 See Fundamentals of Speech Recognition by Lawrence Rabiner and Biing-
211 Hwang Juang, Prentice Hall, 1993.
212
214 The function takes the following arguments:
215
216 dist The distance of the optimal path.
217
218
219 path The optimal path.
220
221
222 lpath The length of the optimal path.
223
224
225 dobs The observed data array.
226
227
228 lobs The length of the observed data array.
229
230
231 state Pointer to the internal state structure.
232
233
235 The function returns MLIB_SUCCESS if successful. Otherwise it returns
236 MLIB_FAILURE.
237
239 See attributes(5) for descriptions of the following attributes:
240
241
242
243
244 ┌─────────────────────────────┬─────────────────────────────┐
245 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
246 ├─────────────────────────────┼─────────────────────────────┤
247 │Interface Stability │Committed │
248 ├─────────────────────────────┼─────────────────────────────┤
249 │MT-Level │MT-Safe │
250 └─────────────────────────────┴─────────────────────────────┘
251
253 mlib_SignalDTWVectorInit_F32(3MLIB), mlib_SignalDTWVector_F32(3MLIB),
254 mlib_SignalDTWVectorPath_F32(3MLIB), mlib_SignalDTWVector‐
255 Free_F32(3MLIB), attributes(5)
256
257
258
259SunOS 5.11 23 May 200m7lib_SignalDTWVectorPath_F32(3MLIB)