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

Algorithm 3 Motif selection algorithm with prediction.

Require: B, the Codebook of the motifs; S(i), the segment to be compressed; d(·), a dissimilarity metric; dth, the compression distortion threshold; PM, the prediction matrix; X⌂(i−N), the previous best motif.
dmin ← ∞
O¯Q((1/N)k=1NSi+k-1)
Q(GAIN(S(i)))
 sort B according to the row of PM related to (iN)
for all X(k) ∈ B do
  XR(k) ← X(k) +
  if d(S(i),XR(k)) < dminthen
   (i) = XR (k)
   dmin = d(S(i),XR(k))
  end if
  if dmindth then
   Break
  end if
end for
 Return k