-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmstamp.q
More file actions
23 lines (19 loc) · 723 Bytes
/
mstamp.q
File metadata and controls
23 lines (19 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/ Multidimensional stamp code - Matrix Profile VI: Meaningful Multidimensional
Motif Discovery - doi:10.1109/icdm.2017.66
\l utl.q
a:"f"$(3,4196)#1000?1f;
w:30; t:til w; ca:til neg[w]+1+count a 0; .Q.gc[];
nak:a@\:ca+\:t;
\ts nsdp:{nak[x]$\:/:nak[x]}each til count nak
nsmasva:(var;avg)@\:/:/:nak
c0:sqrt nsmasva[;;0];c1:nsmasva[;;1];
v0:{(c0 x)*/:c0 x}each til count c0
v1:{(c1 x)*/:c1 x}each til count c1
\ts D:{sqrt 2*w*(1-nsdp[x]-w*v1[x])%w*v0[x]}each til count nsdp
\ts D:(@/)''[D;where each '0n='D;:;"f"$2 xexp 32]
\ts SD:flip each (asc)@\:''flip each D
.Q.gc[];
\ts {flip asc each flip D x}each til count D
kk:first each 'where each '(min each 'SD)=''SD
g:kk+\:\:t
\ts (a@\:ca+\:t),''{a[x]@g x}each til count a