Download presentation

Presentation is loading. Please wait.

Published byDonovan Thomasson Modified about 1 year ago

1
Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson

2
Fundamental tools: clustering Clustering: Group similar objects into clusters.

3
Fundamental tools: clustering Clustering: Group similar (sub)curves into clusters. Similarity measure: Fréchet distance Question: Do we need any constraints on a cluster? Constraints on subcurves in a cluster?

4
Aim: Cluster subcurves Cluster of subcurves

5
Subtrajectory clustering

6

7

8

9
Recall: Fréchet Distance Fréchet Distance measures the similarity of two curves. Dog walking example - Person is walking his dog (person on one curve and the dog on other) - Allowed to control their speeds but not allowed to go backwards! - Fréchet distance of the curves: minimal leash length necessary for both to walk the curves from beginning to end

10
Input: Two polygonal chains P= p 1, …, p n and Q= q 1, …, q m in R d. The Fréchet distance between P and Q is: where and range over all continuous non-decreasing reparametrizations. Note that (0)=p 1, (1)=p n, (0)=q 1 and (1)=q m. Well-suited for the comparison of curves since it takes the continuity of the curves into account. Recall: Fréchet Distance

11
Decision algorithm: compute path Algorithm: 1. Compute Free Space diagram mn cells O(mn) time 2. Compute a non-xy-decreasing path from (q 1,p 1 ) to (q m,p n ). Build network O(mn) time. Find a path O(mn) time. ( q 1,p 1 ) (q m,p n ) P Q

12
Cluster Input: A polygonal curve T, an integer m>1 and a distance d. Cluster: m subcurves T 1, …, T m of T with distance at most d between any two subcurves. Constraints?

13
Cluster Input: A polygonal curve T, an integer m>1 and a distance d. Cluster: m subcurves T 1, …, T m of T with distance at most d between any two subcurves. Constraint 1: subcurves are pairwise disjoint

14
Cluster Input: A polygonal curve T, an integer m>1 and a distance d. Cluster: m subcurves T 1, …, T m of T with distance at most d between any two subcurves. Constraint 1: subcurves are pairwise disjoint More constraints? d infinite number of clusters

15
Cluster Input: A polygonal curve T, an integer m>1 and a distance d. Cluster: m subcurves T 1, …, T m of T with distance at most d between any two subcurves. Constraint 1: subcurves are pairwise disjoint Constraint 2: cluster has to be maximal “length” d infinite number of clusters

16
Decision Problem Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T 1, …, T m of T such that: 1.the subcurves are pairwise disjoint, 2.the distance between any two subcurves is at most d, and 3.at least one subcurve has length l.

17
Decision Problem Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T 1, …, T m of T such that: 1.the subcurves are pairwise disjoint, 2.the distance between any two subcurves is at most d, and 3.at least one subcurve has length l.

18
Decision Problem Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T 1, …, T m of T such that: 1.the subcurves are pairwise disjoint, 2.the distance between any two subcurves is at most d, and 3.at least one subcurve has length l. The length of a subcurve cluster is assumed to be maximal.

19
Decision Problem Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T 1, …, T m of T such that: 1.the subcurves are pairwise disjoint, 2.the distance between any two subcurves is at most d, and 3.at least one subcurve has length l. The length of a subcurve cluster is assumed to be maximal.

20
Decision Problem Given a trajectory T, a subtrajectory cluster SC(m,l,d) of T consists of at least m subtrajectories T 1, …, T m of T such that: 1.the subtrajectories are pairwise disjoint, 2.the distance between any two subtrajectories is at most d, and 3.at least one subtrajectory has length l. The length of a subtrajectory cluster is assumed to be maximal.

21
Problem Decision version: Subtrajectory cluster SC(m,l,d) Given a trajectory T, is there a subtrajectory cluster with parameters m, l and d? Optimisation versions: SC(m,max,d) – maximise length of cluster

22
Hardness results Theorem 1: Finding any approximation of the SC(m,max,d) problem is 3SUM-hard. Theorem 2: The decision problem SC(m,l,d) is NP-complete. Theorem 3: The problem of computing a (2- )-distance approximation of the SC(m,max,d)-problem is NP-hard. [Gudmundsson & van Kreveld’08]

23
Hardness results Theorem 2: The decision problem SC(m,l,d) is NP-complete. Reduction from MaxClique MaxClique: Is there a clique of size k in a given graph G=(V,E)? Clique of size 4

24
Longest subtrajectory cluster: NP-complete Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e

25
Longest subtrajectory cluster: NP-complete Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e

26
Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e Longest subtrajectory cluster: NP-complete

27
Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e Longest subtrajectory cluster: NP-complete

28
Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e Longest subtrajectory cluster: NP-complete

29
Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e Longest subtrajectory cluster: NP-complete

30
Problem: SC(m,l=n,d). b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique b,c,d a e Longest subtrajectory cluster: NP-complete

31
Problem: SC(m,l=n,d). a b,c,d e b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique Longest subtrajectory cluster: NP-complete

32
a b c d e MaxClique SC(m,l=n,d) Clique of size m in G Problem as hard as MaxClique! b,c,d e b a,c,e d c a,b d,e a,e b,c d b,d a,c e a Longest subtrajectory cluster: NP-complete Problem: SC(m,l=n,d).

33
Hardness results Theorem 2: The decision problem SC(m,l,d) is NP-complete.

34
Problem: SC(m,l=n,d). a b,c,d e b a,c,e d c a,b d,e a,e b,c d b,d a,c e a b c d e MaxClique Longest subtrajectory cluster: NP-complete

35
Hardness results Theorem 3: The problem of computing a (2- )-distance approximation of the SC(m,max,d)-problem is NP-hard.

36
Hardness results Theorem 3: The problem of computing a (2- )-distance approximation of the SC(m,max,d)-problem is NP-hard. Corollary 1: The problem of computing a (2- )-distance approximation of SC(max, l, r), for any constant 0 < < 1, is at least as hard as approximating MaxClique.

37
Hardness results Theorem 3: The problem of computing a (2- )-distance approximation of the SC(m,max,d)-problem is NP-hard. Corollary 1: The problem of computing a (2- )-distance approximation of SC(max, l, r), for any constant 0 < < 1, is at least as hard as approximating MaxClique. Can we find a 2-distance approximation in polynomial time?

38
Fréchet distance between m curves Input: Set of m polygonal curves F = {F 1, …, F m } with |F i | = n i The Fréchet distance of F can be computed by computing the Fréchet distance between every pair of curves. Time: O( (n i n j log n i n j )) i,j If |F i | = n/m then O((n/m) 4 log n/m).

39
Fréchet distance between m curves Input: Set of m polygonal curves F = {F 1, …, F m } with |F i | = n i Observation: Given F1, F2 and F3, we have: F (F1,F3) F (F1,F2) + F (F2,F3). [Dumitrescu & Rote’04]

40
Fréchet distance between m curves Input: Set of m polygonal curves F = {F 1, …, F m } with |F i | = n i Observation: Given F1, F2 and F3, we have: F (F1,F3) F (F1,F2) + F (F2,F3). Can we use this observation to get an approximation? a b a+b [Dumitrescu & Rote’04]

41
Fréchet distance between m curves Input: Set of m polygonal curves F = {F 1, …, F m } with |F i | = n i Idea: Select a representative curve F 1 of F. Compute the maximum Fréchet distance D between F 1 and all other curves in F.

42
Fréchet distance between m curves Input: Set of m polygonal curves F = {F 1, …, F m } with |F i | = n i Idea: Select a representative curve F 1 of F. Compute the maximum Fréchet distance D between F 1 and all other curves in F. D F 2D Observation: Gives a 2-approximation

43
Fréchet distance between m curves Input: Set of m polygonal curves F = {F 1, …, F m } with |F i | = n i Idea: Select a representative curve F 1 of F. Compute the maximum Frechet distance D between F 1 and all other curves in F. D F 2D Observation: Gives a 2-approximation Time: O( (n 1 n i log n 1 n i )) i

44
Decision algorithm: compute path Recall: Deciding if the Fréchet distance between two curves P and Q is less than r can be computed in O(mn) time. The Fréchet distance between two polygonal curves P and Q can be computed in O(mn log mn) time using parametric search. ( q 1,p 1 ) (q m,p n ) P Q Q P

45
Recall the problem Given a trajectory T, a subtrajectory cluster SC(m,l,d) of T consists of at least m subtrajectories T 1, …, T m of T such that: 1.the subtrajectories are pairwise disjoint, 2.the distance between any two subtrajectories is at most d, and 3.at least one subtrajectory has length l.

46
Recall the problem Constraint: For simplicity we will assume that all sub- trajectories in a cluster has to start and end at a vertex. Input: A trajectory T with n points, an integer m>1 and a real value d>0. Output: SC(m,max,d) Idea: Create a free space diagram describing the distance between T and T.

47
Free space diagram of T T

48
T

49
T A B C D(A,C) d D(B,C) d D(A,B) 2d

50
Free space diagram of T A B C C: representative trajectory The length of the SC {A,B,C} is the length of the representative trajectory.

51
Free space diagram of T

52

53

54
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R L R While sweeping maintain network of critical points.

55
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

56
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

57
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

58
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

59
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

60
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

61
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

62
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

63
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

64
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

65
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

66
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

67
Approximation algorithm 1.Sweep the free space diagram from left to right with two vertical lines (L and R) 2.At each event point decide if there are m monotone curves between L and R a) If “yes” then move R to the right b) If “no” and R-L=1 then move R to the right the right c) If “no” and R-L>1 then move L to the right L R

68
Data structures Number of event points? L R

69
Data structures Number of event points? L R

70
Data structures Number of event points? O(n) L R Two types of events: 1.L moves to the right 2.R moves to the right How to handle an event? Decide if there are m non- overlapping xy-monotone paths between L and R

71
Handle event Start with top-most corner u on R. Find the top-most corner u’ on L that can be reached by a xy- monotone path P. L R Observation: No point on R below u can reach a point on L above u’ with an xy-monotone path. P u’ u

72
Handle event L R P u’ u v v’ Start with top-most corner u on R. Find the top-most corner u’ on L that can be reached by a xy- monotone path P. Observation: No point on R below u can reach a point on L above u’ with an xy-monotone path.

73
Handle event L R Next take the top-most corner v on R below u’. Find the top-most corner on L that can be reached by a xy-monotone path. Continue until: 1.m curves found, or 2.no more corners on R. P u’ u v v’ Start with top-most corner u on R. Find the top-most corner u’ on L that can be reached by a xy- monotone path P.

74
Path Query in the Free Space diagram Recall querying for a path in lecture 1. O(n 2 ) time per query O(n) events, n points on R Total: O(n 3 w) time and O(nw) space, where w = max (R-L) In worst case the algorithm performs n path queries. How do we perform a path query?

75
Path Query in the Free Space diagram Can it be improved? In worst case the algorithm performs n path queries. How do we perform a path query? O(n 2 w) time and O(nw) space

76
L R Path Query in the Free Space diagram Can it be improved? In worst case the algorithm performs n path queries. How do we perform a path query? O(n 2 w) time and O(nw) space Extension: The algorithm can be modified to handle the case when only the “reference” trajectory needs to start an end at vertex.

77
Approximation algorithm Theorem: A 2-distance approximation of the SC(m,max,d) problem can be computed in O(n 2 +nmw) time and O(nw) space using the discrete Fréchet distance. Theorem: A 2-distance approximation of the SC(m,max,d) problem can be computed in time O(n 2 w) using the continuous Fréchet distance if reference trajectory starts and ends in vertex. Theorem: A 2-distance approximation of the SC(m,max,d) problem can be computed in time O(n 3 m 2 (n/m) (log 2 n+m)) using the continuous Fréchet distance. [Joint work: Buchin, Buchin, Löffler and Luo’10]

78
Experimental Results (continuous!) Note: Continuous model input data can be simplified! [Joint work with Nacho Valladares’13] i5-200 CPU with a Nvidia GTX 580

79
Open Problems 1.Can we cluster faster? 2.Can a c-approximate Fréchet clustering be computed faster? 3.Can we cluster faster for special cases? 4.What should we report? 5.Cluster using other distance measures? For example using [Sankaramanet al. 2013]?

80
References K. Buchin, M. Buchin, J. Gudmundsson, M. Loffler and J. Luo. Detecting Commuting Patterns by Clustering Subtrajectories. International Journal on Computational Geometry and Applications, N. Valladares and J. Gudmundsson. A GPU approach to subtrajectory clustering using the Fréchet distance. ACM SIGSPATIAL A. Dumitrescu and G. Rote. On the Fréchet distance of a set of curves, Proceedings of the Sixteenth Canadian Conference on Computational Geometry, S. Sankararaman, P. K. Agarwal, T. Mølhave, J. Pan and A. P. Boedihardjo. Model-driven matching and segmentation of trajectories. ACM SIGSPATIAL, 2013

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google