An Optimal Linear Time Algorithm for Quasi

An Optimal Linear Time Algorithm for
Quasi-Monotonic Segmentation
DANIEL L EMIRE (UQAM),
M ARTIN B ROOKS (NRC),
Y UHONG YAN (NRC)
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
A definition to begin with!
A function F is monotonic if
F(x) ≥ F(z) whenever x > z (increasing) or
F(x) ≤ F(z) whenever x > z (decreasing).
Monotonicity is:
morphologic: slopes don’t matter, you can “time warp”!
sample-removal oblivious: missing points don’t matter.
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Piecewise quasi-constant scattered data
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Segmentation of piecewise quasi-constant
scattered data
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Piecewise quasi-linear scattered data
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Segmentation of piecewise quasi-linear scattered
data
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Piecewise quasi-monotonic scattered data
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Segmentation of piecewise quasi-monotonic
scattered data
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
A Generic Segmentation Problem
for segmentation: S = {S1, S2, ...}
define an error metric Q : e.g. linearity, monotonicity, ...
Given error ε
. ε = max(Q(S1), Q(S2), . . .)
find segmentation with least number of segments.
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Quantifying monotonicity: pretty good
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Quantifying monotonicity: good
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Quantifying monotonicity: not good
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
How do we measure how monotone something is?
Given yi, find monotonic sequence zi minimizing
Q = maxi |yi − zi| (l∞ error)
Surprise! It is an easy problem.
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Demonstration: seek the best monotonic increasing
approximation function
f
f (x)=max{F(y):y<=x}
f (x) = (f (x) + f (x))/2
b
d
c
e
g
f (x)=min{F(y):y>=x}
a
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
A multiscale approach for monotonicity
Label each extrema with a scale parameter.
Intuition is that some extrema are “details” others are important
(coarse).
Scale is defined by the y-axis metric (large variation: large scale).
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
A multiscale approach for monotonicity (2)
COARSE VERSION
scale=10
scale=10
scale=1
scale=1
scale=10
Nov. 28, 2005
scale=10
Quasi-Monotonic Segmentation
scale=10
scale=10
à á á à n 6
Maximal pairs (2)
maximal pair
pair
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Scale of an extrema versus max. pairs
maximal pair
maximal pair
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
Stack-based Labelling: O(n) (one pass)
d
c
b
c,b maximal
pair
a
a
c
a
b
c
a
stack, with access to
2 top values
Nov. 28, 2005
d
d
b d>c
a
c
a
c,b maximal
pair
Quasi-Monotonic Segmentation
à á á à n 6
THM: top k + 1 extrema give k-segmentation
Pick all extrema at scale δ or more. This is an optimal monotonic segmentation!
The converse is also true: pick the top k + 1 extrema having
higher scale than the rest, and it is an optimal segmentation.
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6
A simple O(nk) optimal segmentation algorithm
We can label the extrema in time O(n) (one pass).
Filter to find the top k extrema in time O(nk).
Nov. 28, 2005
Quasi-Monotonic Segmentation
à á á à n 6