Skip to main content
. 2013 Dec 19;14(1):68–94. doi: 10.3390/s140100068

Algorithm 2 Motif selection algorithm.

Require: B, the Codebook of the motifs; S(i), the segment to be compressed; d(·), a dissimilarity metric; dth, the compression distortion threshold.
dmin ← ∞
O¯Q((1/N)k=1NSi+k-1)
Q(GAIN(S(i)))
for all X(k) ∈ B do
  XR(k) ← X(k) +
  if d(S(i),XR(k)) < dmin then
   (i) = XR (k)
   dmin = d(S(i),XR(k))
  end if
end for
 Return k